Foreach on IEnumerable property and CheckBoxFor in ASP.Net MVC

后端 未结 2 1848
面向向阳花
面向向阳花 2020-12-30 07:48

I believe this question applies to any of the \"For\" Html helpers, but my specific problem is using CheckBoxFor...

I have a model that is of type IEnumerable, where

2条回答
  •  旧巷少年郎
    2020-12-30 08:28

    I guess you had problems because this didn't work

    <%=Html.CheckBoxFor(access) %>
    

    and this didn't work either

    <%=Html.CheckBoxFor(access=>access.HasAccess) %>
    

    but this should work

    <%=Html.CheckBoxFor(x=>access.HasAccess) %>
    

提交回复
热议问题