如何將readonly屬性設置爲HTML Textbox助手類。只讀文本框在ASP.net MVC查看
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email" })%>
感謝您迴應 感謝
如何將readonly屬性設置爲HTML Textbox助手類。只讀文本框在ASP.net MVC查看
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email" })%>
感謝您迴應 感謝
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", @readonly="readonly" }) %>
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", readonly="true" })%>
仙,球,只讀是保留字。我失敗了。 – Will 2010-01-29 21:00:22
@符號繞過保留字。 – VoodooChild 2010-11-26 22:36:15
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", @readonly = "readonly" })%>
<%= Html.TextBox("Email", "[email protected]", new { @class = "required email", @readonly="readonly" })%>
@符號繞過保留字。
爲了獲得更好的性能,使用以下命令:
ASPX:
<%= Html.TextBox("Email", ew Dictionary<string, object> { {"class","required email"}, {"readonly","readonly"} } %>
剃刀:
@Html.TextBoxFor(model => model.Email, new Dictionary<string, object> { { "class", "required email" }, {"readonly","readonly"} })
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @readonly = "readonly" } })
作品對我來說
這個解決方案應該用於跨瀏覽器嗎? – 2014-05-27 12:48:07