- Html.TextBox and Html.DropDownList are not Strongly typed and hence they doesn’t require a Strongly typed View. This means we can hard code whatever name we want. On the other hand, Html.TextBoxFor and Html.DropDownListFor are Strongly typed, so require a Strongly typed View and the name is inferred from thelambda expression.
@Html.TextBoxFor(m => m.Name)
- Whether we use Html.TextBox or Html.TextBoxFor, the end result will be the same, that is they will produce the same HTML.
The above 2 lines of code will produce same HTML as shown below.
<input id=“Name” name=“Name” type=”text”/>
- Strongly typed HTML helpers provide compile time error checking which is not provided by the other.
- Since it is a good practice to use Strongly typed Views, it is always preferred to use Html.TextBoxFor and Html.DropDownListFor over their counterparts.
- Strongly typed HTML helpers are added in ASP.Net MVC 2.