ASP.NET MVC 3: Override “name” attribute with TextBoxFor

前端 未结 11 1508
臣服心动
臣服心动 2020-11-28 05:41

Is it possible when using Html.TextBoxFor to override the name attribute?

I have tried with no success. I need to use TextBoxFor to get client side vali

11条回答
  •  無奈伤痛
    2020-11-28 06:14

    @Html.EditorFor(Model => Model.Something, "name", "name", new {@class = "form-control" })
    

    Not sure which of those two string parameters in the middle do the work, but it worked only when I typed both of them.

提交回复
热议问题