How to give the id to the html textbox? Anonymous User286425-Sep-2013How to give the id to the html textbox?My html tag looks like this<%=Html.TextBox("username")%>Any suggestions?html5html5 Updated on 25-Sep-2013
Anonymous User
25-Sep-2013By default, the TextBoxFor element will have an ID and NAME property that matches the expression property of the element.
@Html.TextBoxFor(model => model.ProductName)
In this example, the ID and NAME would be "ProductName"
If you want to specify an ID or NAME that's different from the expression property, you can use the htmlAttributes overload param.
@Html.TextBoxFor(model => model.ProductName, new { id = "myProduct", name = "myProduct" })