What is the equivalent of UserControl in ASP.NET MVC?

Posted on

Question :

In Web Forms we have UserControl . These controls have a code-behind and a layout. They can be used in different projects / solutions without depending on other things.

I want to create a control that displays multiple elements and some links / buttons that “trigger an event”. I do not want this control to be linked to my site, I want to be able to reuse it on other websites.

What is the equivalent in MVC? Is it possible to compile Controller and View into one DLL and use it in another project?

    

Answer :

What you are looking for is a HtmlHelper (

Leave a Reply

Your email address will not be published. Required fields are marked *