What is the best practice for creating an ASP.NET MVC control or helper?
-
02-07-2019 - |
Question
I'm looking to build an reusable control or custom helper for my MVC project. I'm sure there is a best practice for this. Any help is appreciated.
Solution
Sure, the best practices are encapsulated in the HtmlHelpers and other helpers in the MVC source code. You can get the source at http://www.codeplex.com/aspnet
OTHER TIPS
(Hate to disagree with you Scott) Using HtmlHelpers is not a best practice. It is not a practice that has been sharpened through use on real projects and is only one approach. I have recently written a little post on using SubControllers.. we use HtmlHelpers for some small things, but we use SubControllers for greater control, composition and dependency inversion.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow