Geeks With Blogs
Shravan's Articles on .NET A .NET Blog

ASP.NET MVC provides many built-in HTML Helpers.  With help of HTML Helpers we can reduce the amount of typing of HTML tags for creating a HTML page.

 For example we use Html.TextBox() helper method it generates html input textbox. Write the following code snippet in MVC View:

It generates the following html in output page:
<input id="txtName" name="txtName" type="text" value="20" />
List of built-in HTML Helpers provided by ASP.NET MVC.
  • ActionLink() - Links to an action method.
  • BeginForm() - Marks the start of a form and links to the action method that renders the form.
  • CheckBox() - Renders a check box.
  • DropDownList() - Renders a drop-down list.
  • Hidden() - Embeds information in the form that is not rendered for the user to see.
  • ListBox() - Renders a list box.
  • Password() - Renders a text box for entering a password.
  • RadioButton() - Renders a radio button.TextArea() - Renders a text area (multi-line text box).
  • TextBox () - Renders a text box.

How to develop our own Custom HTML Helpers?

For developing custom HTML helpers the simplest way is to write an extension method for the HtmlHelper class. See the below code, it builds a custom Image HTML Helper for generating image tag.

Read The Remaining Blog Post @


Posted on Friday, March 18, 2011 7:30 PM ASP.NET , ASP.NET MVC | Back to top

Copyright © Shravan Kumar | Powered by: