ASP.NET MVC > View - Form specific

Text box in ASP.NET MVC view in ASP.NET MVC

How to create a text box in the ASP.NET MVC view?

To create a textbox, use @Html.TextBox helper method. 

@Html.TextBox("FirstName", "Value Optional") 

If the view is using Model and we need to create a textbox corresponding to the Model property, we can use @Html.TextBoxFor helper method

@Html.TextBoxFor(model => model.FirstName) 


@Html.EditorFor(model => model.FirstName) 

The difference between @Html.TextBoxFor and @Html.EditorFor are following 

Taken from 

 Views: 3628 | Post Order: 27

Write for us