How to create read only checkbox MVC?

asp.net-mvc, c#

Solution

Just use `DisplayFor` instead of `EditorFor`.

If you need the value to be included in the form submission you could add a `HiddenFor` as well.

<td class="adminData">
    @Html.DisplayFor(model => model.IsHireSet)
    @Html.HiddenFor(model => model.IsHireSet)
</td>

Problem

I'm using MVC. In the view there is check box, So I want to make it read only or user can't change it.. This is my view ``` <tr id="pnHireSet"> <td class="adminTitle"> @Html.LabelFor(model => model.IsHireSet): </td> <td class="adminData"> @Html.EditorFor(model => model.IsHireSet) //This is check box. I want set is read only.... @Html.ValidationMessageFor(model => model.IsHireSet) </td> </tr> ``` How can I do it?? Thankx.

Original source