Adding id to MVC form input
I have this HT开发者_如何学JAVAML input in a asp.net MVC page:
<%=Html.TextBox("Submission.FirstName", null, new { @class = "fname title" })%>
How can I add an id to it?
simple
<%=Html.TextBox("Submission.FirstName", null, new { @class = "fname title", id = "my-id-here" })%>
After that you will see the id in the html markup after it will be rendered
The id will be set using the name you supply. In this case the id will be "Submission_FirstName".
精彩评论