How to expand the System.Web.UI.WebControls.WebControl base class?

J

Jheitmuller

Using C# I want to add the same functionality to all of the web
controls in an ASP.NET application; specifically to:

System.Web.UI.WebControls.Panel
System.Web.UI.WebControls.DataGrid
System.Web.UI.WebControls.ListBox
System.Web.UI.WebControls.Button

Initially, my thought was to derive a class from the .NET WebControl
class called MyWebControl and add my functionality to it. Then I
would create a class called MyPanel that would inherit both my
MyWebControl and the .NET Panel class.

System.Web.UI.WebControls.Panel --> New MyPanel class
MyWebControl class -->

Because C# does not support multiple inheritance this won't work. The
only solution I can think of is to create four separate derived
classes from each of these controls and implementing the added
features four times. (Bad design)

Anybody have any thoughts on how to avoid implementing my web control
code in each class that I derive from the .NET web controls?
 
A

apple

And what functionality you will become with inheritance from Panel control?
The best way here in my opinion is to create only one base parent class thah
incapsulate everything necessary properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top