control name in TextBoxFor in MVC3

前端 未结 5 1039
孤城傲影
孤城傲影 2020-12-11 04:45

Is it possible to control the name attribute of say a text boxt when using TextBoxFor?

this code in the view

@Html.TextBoxFor(m => m.SearchParams         


        
5条回答
  •  难免孤独
    2020-12-11 05:27

    @Html.TextBoxFor(model => model.attr, new { Name = "txt1" })
    

    Just Use "Name" instead of "name"

提交回复
热议问题