We understand what the HTML helper in asp.net MVC is
First we use HTML helpers in a view to render HTML content in asp.net MVC
An HTML helper is just a method that returns a string.
The one of the basic things of any web application is to render HTML as an output. We have ASP.NET Webforms and
ASP.NET MVC framework
both will render HTML very well but they do this thing in a different way.
In ASP.NET Webforms they just drag and drop the control on Form and in code behind .cs page they just bind data to it and it starts displaying data. In asp.net webforms server controls are used to generate HTML.
In ASP.NET MVC they don't have any server controls. In MVC they have only HTML controls check the toolbox they will find all sorts of HTML controls there. The MVC HTML helpers will help us to render HTML in the browser.
If they will come from ASP.NET webforms development background then we will think ASP.NET Webforms is better as compare to ASP.NET MVC because here we need to write the bulk of HTML which will get rendered in the browser and writing the whole HTML will make developers bit crazy. The ASP.NET MVC came up with HTML Helpers which will help us to render HTML in the browser.
HTML helpers and server controls are the same and both are used to render HTML on browser but if we use HTML helpers we not need ViewState to maintain its state but server controls will use ViewState to maintain its state and data.
The list of HTML helper methods available in asp.net MVC are given below:-
1. @Html.BeginForm
2. @Html.EndForm
3. @Html.TextBox
4. @Html.TextArea
5. @Html.Password
6. @Html.Hidden
7. @Html.CheckBox
8. @Html.RadioButton
9. @Html.DropDownList
10. @Html.ListBox
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
HTML Helpers in Asp.Net MVC
We understand what the HTML helper in asp.net MVC is
The one of the basic things of any web application is to render HTML as an output. We have ASP.NET Webforms and ASP.NET MVC framework both will render HTML very well but they do this thing in a different way.
If they will come from ASP.NET webforms development background then we will think ASP.NET Webforms is better as compare to ASP.NET MVC because here we need to write the bulk of HTML which will get rendered in the browser and writing the whole HTML will make developers bit crazy. The ASP.NET MVC came up with HTML Helpers which will help us to render HTML in the browser.
HTML helpers and server controls are the same and both are used to render HTML on browser but if we use HTML helpers we not need ViewState to maintain its state but server controls will use ViewState to maintain its state and data.
The list of HTML helper methods available in asp.net MVC are given below:-
1. @Html.BeginForm
2. @Html.EndForm
3. @Html.TextBox
4. @Html.TextArea
5. @Html.Password
6. @Html.Hidden
7. @Html.CheckBox
8. @Html.RadioButton
9. @Html.DropDownList
10. @Html.ListBox