开发者

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

开发者 https://www.devze.com 2023-01-28 12:13 出处:网络
I generate html textbox in this way: <%: Html.TextBoxFor(m => m.Category) %> ASP.NET MVC render html:

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

精彩评论

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