I have the following tag with a Html.TextBoxFor expression and I want the contents to be read only, is this possible?
<%= Html.TextBoxFor(m => Model.E
Use the following:
@Html.TextBoxFor(m => m.Whatever, new {@readonly = "readonly"})
If you want to assign a class to it you could do it the same way , by adding the @class = "" property. Hope this helps :)
An other possibility :
<%= Html.TextBoxFor(model => Model.SomeFieldName, new Dictionary<string, object>(){{"disabled", "true"}}) %>
Using the example of @Hunter, in the new { .. } part, add readonly = true, I think that will work.