开发者

Hide check box from controller-MVC

How can i hide/show a check box based on a value obtained from controller. I am using the given below code for check box

   &l开发者_StackOverflow社区t;%= Html.CheckBoxFor(m =>m.IncludeCallWithNoAgents) %>


Your view model could contain a property which would be set by the controller action and which should indicate whether this checkbox should be shown or not:

<% if (Model.ShouldShowCheckBox) { %>
    <%= Html.CheckBoxFor(m => m.IncludeCallWithNoAgents) %>
<% } %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜