print mvc htmlstring example displayfor asp.net-mvc

htmlstring - leer solo Textbox en ASP.net MVC View



mvchtmlstring example (6)

Cómo establecer el atributo de solo lectura para la clase de ayuda HTML Textbox.

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

Aprecia tu respuesta Gracias


Para un mejor rendimiento, use lo siguiente:

ASPX:

<%= Html.TextBox("Email", ew Dictionary<string, object> { {"class","required email"}, {"readonly","readonly"} } %>

Maquinilla de afeitar:

@Html.TextBoxFor(model => model.Email, new Dictionary<string, object> { { "class", "required email" }, {"readonly","readonly"} })


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


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

El símbolo @ omite la palabra reservada.


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


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


@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @readonly = "readonly" } })

funciona para mi