[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

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

john

2/7/2004 5:53:00 PM

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?
1 Answer

apple

2/7/2004 6:07:00 PM

0

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.



"Jheitmuller" <john@jrcc.net> wrote in message
news:de16c5ec.0402070952.7758499e@posting.google.com...
> 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?