I’m coming from a ASP.NET Webforms application. I’m using a third party control from which I created a descendant to set some default values. I then registered that class as a tag and I’m ready to go without setting the options ever and ever again.
Now I want to go to a MVC based application. I’m curious how to do that. Is there a way to “subclass” an extension there, too?
Edit: Done this with DevExpress MVC Grid extension
The third party control is another story entirely, and the vendor would have to release an ASP.NET MVC version.
However, in simple terms of creating re-usable code in ASP.NET MVC one option you have is to create custom HTML helpers. It basically ends up being a method that you call which outputs markup, which can be made fairly powerful fairly quickly.
There are a lot of resources on various HTML Helpers, and keep in mind that the “documentation” you find on Google has changed significantly over the versions of ASP.NET MVC, so take care to ensure you’re not limiting yourself to “an old way” of doing things. There are also a number of commercial as well as free products and open-source projects with handy helpers and extensions.