Top Banner
Writing Custom HTML Helpers in ASP.NET MVC Lohith G. N., Microsoft MVP, Telerik
13
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Creating Custom HTML Helpers In ASP.NET MVC

Writing Custom HTML Helpers in ASP.NET MVC

Lohith G. N., Microsoft MVP, Telerik

Page 2: Creating Custom HTML Helpers In ASP.NET MVC

About Me

• Lohith G N

• Microsoft MVP (ASP.NET/IIS)

• Author

• BDotNet

• @kashyapa

• http://about.me/kashyapa

Page 3: Creating Custom HTML Helpers In ASP.NET MVC

Agenda

• Understanding HTML Helpers

• Standard Helpers in ASP.NET MVC

• Writing Custom Helpers

Page 4: Creating Custom HTML Helpers In ASP.NET MVC

UNDERSTANDING HTML HELPERS IN ASP.NET MVC

Page 5: Creating Custom HTML Helpers In ASP.NET MVC

HTML Helpers

• Method that returns String

• Avoid tedious typing of HTML Tags

• Render any content using Helpers

Page 6: Creating Custom HTML Helpers In ASP.NET MVC

STANDARD HELPERS IN ASP.NET MVC

Page 7: Creating Custom HTML Helpers In ASP.NET MVC

Standard HTML Helpers

• @Html.Label(), @Html.LabelFor()

• @Html.TextBox(), @Html.TextBoxFor()

• @Html.TextBox(), @Html.TextBoxFor()

• @Html.DropDownList(), @Html.DropDownListFor()

• …

Page 8: Creating Custom HTML Helpers In ASP.NET MVC

DEMO:

HTML HELPERS

Page 9: Creating Custom HTML Helpers In ASP.NET MVC

CUSTOM HTML HELPERS

Page 10: Creating Custom HTML Helpers In ASP.NET MVC

Custom HTML Helpers

• @helper

• Static Methods

• Extension Methods

• Fluent Extension Methods

Page 11: Creating Custom HTML Helpers In ASP.NET MVC

DEMO:

CUSTOM HTML HELPERS

Page 12: Creating Custom HTML Helpers In ASP.NET MVC
Page 13: Creating Custom HTML Helpers In ASP.NET MVC

Q & A ?