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.
精彩评论