【发布时间】:2011-02-06 03:42:04
【问题描述】:
我正在尝试使用 asp.net mvc 2 中的 html 助手输出以下 html:
<input type="text" id="Name" name="Name" value="" autofocus />
我现在正在使用此代码:
<%= Html.TextBoxFor(x => x.Name) %>
我试过了
// results in <input ... autofocus="" />
<%= Html.TextBoxFor(x => x.Email, new { autofocus="" }) %>
// does not compile
<%= Html.TextBoxFor(x => x.Email, new { autofocus=null }) %>
有什么方法可以使用 html 帮助程序来完成我正在寻找的东西吗?
【问题讨论】: