2011年1月4日 星期二

.Net MVC2 的 Html.TextBoxFor 加入 Html Attributes

一般在使用 .Net MVC2 時, 都會使用 Html.TextBoxFor 方式產生前端的

HTML Tag, 如果想要加入 Html Tag 的 Attributes 參數時, 可以使用以

下的做法

...
<%: Html.TextBoxFor(m => m.UserName, new { @class = "ui-widget-content ui-corner-all" })%>
...