Change id attribute of an html.editorfor helper in MVC4 with Razor

前端 未结 4 710
一个人的身影
一个人的身影 2021-01-01 02:16

I have looked through some various answers related to this but all were for mvc3 or not for Razor.

I have a single page that has multiple forms, in partial views, th

4条回答
  •  一个人的身影
    2021-01-01 03:01

    Based on bob's comment :

    EditorFor @Html.EditorFor(model => model.FieldName, new { htmlAttributes = new { id = "myuniqueid"} })
    

    Credits to Bob.

提交回复
热议问题