WebApi 调用Edit后某个ViewModel的字段为nul
2018-07-22 本文已影响27人
AsaGuo
View中未设置该字段“ImageGroupsNum”:
@Html.EditorFor(model => model.ImageGroupsNum, new { htmlAttributes = new { @class = "form-control",@style= "visibility:hidden;" } })
后台Edit方法,未Bind该字段“ImageGroupsNum”:
public ActionResult Edit([Bind(Include = "Id,Name,AboutUs,QRImgName,QRImgUrl,ImageGroupsNum")] WebSiteConfigViewModel webSiteConfig)