How to give the id to the html textbox?

Total Post:134

Points:940

HTML5 
 2193  View(s)
Ratings:
Rate this:

How to give the id to the html textbox?

My html tag looks like this

<%=Html.TextBox("username")%>

Any suggestions?

  1. Re: How to give the id to the html textbox?

    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" })

      Modified On Mar-31-2018 01:57:33 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.