以增加控件的maxlength属性为例,有以下几种方式:
<%:Html.TextBoxFor(
model => model.MailReceiver,
new Dictionary<string, object>() {
{ "size", 200 },
{"maxlength", 200},
{ "style", "width:90%" },
{ "onblur", "CheckReceiver()" },
{"onFocus","CheckFoc(0)"}
}
)%>
第二种:
<%= Html.TextBoxFor(m => m.UserName,new {
@maxlength=50,
@style ="border:1px solid #0D5C95;background:#fff;width:170px;height:21px;",
@size="20"
}
) %>