开发者

Hide check box from controller-MVC

开发者 https://www.devze.com 2023-02-16 03:35 出处:网络
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

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

精彩评论

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