开发者

ASP.NET MVC: set custom name to rendered html element

I generate html textbox in this way:

<%: Html.TextBoxFor(m => m.Category) %>

ASP.NET MVC render html:

<input type="text" value="" name="Category" id="Category">

Is there is a way to set manually开发者_StackOverflow社区 name of the textbox not eqaul to property "Category", but something else?

Thanks.


<%: Html.TextBox("someOtherName") %>


You have to change the default editor template or add a new template for this. You can refer this blog post from Brad Wilson for some insight.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜