Read only Textbox in ASP.net MVC View

Viewed 49093

How to set the readonly attribute to HTML Textbox helper class.

<%= Html.TextBox("Email", "abc@example.com", new { @class = "required email" } )%>

Appreciate your response

6 Answers
<%= Html.TextBox("Email", "abc@example.com", new { @class = "required email", @readonly="readonly" }) %>
<%= Html.TextBox("Email", "abc@example.com", new { @class = "required email", @readonly = "readonly" } )%>
<%= Html.TextBox("Email", "abc@example.com", new { @class = "required email", readonly="true" } )%>
Related