How to set the readonly attribute to HTML Textbox helper class.
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email" } )%>
Appreciate your response Thanks
The TextBoxes can be made ReadOnly by setting the HTML ReadOnly attribute using the HtmlAttributes parameter in Html. TextBox and Html. TextBoxFor helper functions.
Solution 1 In razor, everything is easy just add @readonly attribute to the code will do the needful.
You can make the input 'read only' by using 'readonly'. This will let the data be POSTED back, but the user cannot edit the information in the traditional fashion. Keep in mind that people can use a tool like Firebug or Dragonfly to edit the data and post it back.
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", @readonly="readonly" }) %>
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", @readonly = "readonly" } )%>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With