asp.net mvc 中 Html.EditorFor 如何添加 htmlattribute 属性
我想把 @Html.EditorFor(model => model.Email) 在页面上生成只读的.就是添加:readonly="readonly"的html属性啊.
------解决方案--------------------------------------------------------
- C# code
<%= Html.TextBoxFor(model => model.Property, new { disabled="disabled", @readonly = "readonly" })%>
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
@foreach(Person p in Model)
{
@Html.TextBox("PersonName", p.Name, new { @readonly="readonly"})
}
------解决方案--------------------------------------------------------