tags:

views:

361

answers:

5

Hi

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

<%= Html.TextBox("Email", "[email protected]", new { @class = "required email" } )%>

Appreciate your response Thanks

+1  A: 

<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", readonly="true" } )%>

Will
Aw, balls, readonly is a reserved word. I fail.
Will
+2  A: 
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", readonly = "readonly" } )%>
Mattias Jakobsson
+4  A: 
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", @readonly="readonly" }) %>
Alex LE
worked ... thanks
Rita
A: 

how to make a textbox readonly??

mayank
A: 

1

<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", @readonly="readonly" } )%>

@ symbol bypasses the reserved word.

Hacker