Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How (if at all) can you make an ASP.NET UserControl inherit from another UserControl?

In Windows Forms it's easy to inherit one user control from another. The inherited control contains all the controls of the parent form, and you can add some more. Can the same be done with ASP.NET? I'm talking about the .ASCX type of user controls.

like image 686
Vilx- Avatar asked Mar 12 '09 13:03

Vilx-


People also ask

What is Usercontrol in asp net?

User controls. User controls are containers into which you can put markup and Web server controls. You can then treat the user control as a unit and define properties and methods for it. Custom controls. A custom control is a class that you write that derives from Control or WebControl.

Which property is used to set the user control on the form?

User Control properties are used to set the values of a User Control from the parent page.


1 Answers

The short answer is no it can't be easily done. There's no inheritance between user controls or webforms. You can create an inheritance hierarchy between the code behinds classes but the gui components aren't inherited.

like image 56
Tundey Avatar answered Oct 06 '22 00:10

Tundey