How to get the HTML id generated by asp.net MVC EditorFor

前端 未结 4 1850
无人共我
无人共我 2020-12-08 01:55

I use the HTML Helpers to render my fields:

<%=Html.EditorFor(m => m.User.Surname)%>

and the output would be something like this:<

4条回答
  •  无人及你
    2020-12-08 02:33

    ASP.NET MVC 4 has Html.IdFor() built in that can return this:

    @Html.IdFor(m => m.User.Surname)
    

提交回复
热议问题