Html.TextBox not strongly typed and does not require a strongly typed representation, meaning that you can hardcode any name you want as the first argument and provide it with a value:
<%= Html.TextBox("foo", "some value") %>
You can set some value in the ViewData dictionary inside the controller action, and the assistant will use this value when rendering the text field ( ViewData["foo"] = "bar" ).
Html.TextBoxFor requires a strongly typed view and uses a view model:
<%= Html.TextBoxFor(x => x.Foo) %>
The helper will use the lambda expression to display the name and value of the view model passed to the view.
And since it's good to use strongly typed views and view models, you should always use the Html.TextBoxFor .
Darin Dimitrov Feb 25 2018-11-15T00: 00Z
source share