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.Events.Subscribed[i].Action)%>
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.Events.Subscribed[i].Action)%>
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action, new {readonly=true})%>
Hey,
Using the example of @Hunter, in the new { .. } part, add readonly = "readonly", I think that will work.
<%= Html.TextBoxFor(m => Model.Events.Subscribed[i].Action, new { @readonly = true })%>
<%= Html.TextBoxFor(model => Model, new Dictionary<string, object>(){{"readonly", "true"}}) %>
Do realize that this is not a "secure" way to do this as somebody can inject javascript to change this.