Reputation: 315
I am building a website for user privilage setting. I use ASP MVC for programming. In my Database, I have column admin_privilage and user_privilage with value either 1/0.
Here is the screen and the code
<td>@item.admin_privilage</td>
<td>@item.user_privilage</td>
What I want to do is to display it as a checkbox. If the value is true, then displayed as checked box. if false, then displayed as unchecked box.
anyone can help how to do this in asp mvc?
Upvotes: 0
Views: 370
Reputation: 1957
You can use the @CheckBox HTML helper, like this:
<td>@Html.CheckBox("admin_privilage",item.admin_privilage)</td>
<td>@Html.CheckBox("user_privilage",item.user_privilage)</td>
Upvotes: 1