Creating Custom HTML Helpers in ASP.NET MVC
Posted
by Shravan
on Geeks with Blogs
See other posts from Geeks with Blogs
or by Shravan
Published on Fri, 18 Mar 2011 13:30:15 GMT
Indexed on
2011/03/18
16:11 UTC
Read the original article
Hit count: 495
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: 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.
<%=Html.TextBox("txtName",20)%>
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.
Read The Remaing Blog Post @ http://theshravan.net/blog/creating-custom-html-helpers-in-asp-net-mvc/
© Geeks with Blogs or respective owner