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.
Just use
DisplayForinstead ofEditorFor.If you need the value to be included in the form submission you could add a
HiddenForas well.