How to give the id to the html textbox? My html tag looks like this <%=Html.TextBox(\"username\")%> Any suggestions?
By 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" })