Extension method in MVC
Helps us to add a new method to the exisiting type without modifying the original file or inheriting it.
Create Custom Helper for Image Tag using Extenstion method in MVC
- Create a New Folder "HTMLHelpers" for Storing all the HTMLHelpers.
- Create a New Class for ImageHtmlHelper
- Make it a static class and create static method
- Use "this" pointer with "HtmlHelper" class object as a parameter and use all the other required parameters.
- Use the NameSpace of ImageHtmlHelper in View page
- Write a CustomHtmlHelper created and pass all the required parameters to it