Different methods of creating HTML Forms in ASP.NET MVC - part 3
In part 1 and 2 we made in different way HTML Form using the <select> element and <option> tag for different options to choose from. But in this example we'll use HTML Helpers. ASP.NET MVC includes standard helpers for the most common types of HTML elements, like HTML links and HTML form elements (for more about topic go to www.w3schools.com or asp.net ). Because, we are still doing the same form where user inputs his name and chooses favorite color and the form has to look like the one from previous examples, we are going to use just three HTML form elements: - BeginForm() - TextBoxFor() - DropDownListFor()
Some parts are very similar, biggest change happens in the View. Let's start with Model:
And now the Controller. It is almost the same as for the previous part.
And the View looks like this:
Build, run. Should look the same as in part 1.














