Writing Custom HTML Helpers in ASP.NET MVC
Lohith G. N., Microsoft MVP, Telerik
About Me
• Lohith G N
• Microsoft MVP (ASP.NET/IIS)
• Author
• BDotNet
• @kashyapa
• http://about.me/kashyapa
Agenda
• Understanding HTML Helpers
• Standard Helpers in ASP.NET MVC
• Writing Custom Helpers
UNDERSTANDING HTML HELPERS IN ASP.NET MVC
HTML Helpers
• Method that returns String
• Avoid tedious typing of HTML Tags
• Render any content using Helpers
STANDARD HELPERS IN ASP.NET MVC
Standard HTML Helpers
• @Html.Label(), @Html.LabelFor()
• @Html.TextBox(), @Html.TextBoxFor()
• @Html.TextBox(), @Html.TextBoxFor()
• @Html.DropDownList(), @Html.DropDownListFor()
• …
DEMO:
HTML HELPERS
CUSTOM HTML HELPERS
Custom HTML Helpers
• @helper
• Static Methods
• Extension Methods
DEMO:
CUSTOM HTML HELPERS
Q & A ?