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

Discussion in 'ASP .Net Web Controls' started by Jheitmuller, Feb 7, 2004.

  1. Jheitmuller

    Jheitmuller Guest

    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?
    Jheitmuller, Feb 7, 2004
    #1
    1. Advertising

  2. Jheitmuller

    apple Guest

    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" <> wrote in message
    news:...
    > 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?
    apple, Feb 7, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    2
    Views:
    834
    Matt Getting
    Jul 24, 2003
  2. byrd48
    Replies:
    0
    Views:
    3,560
    byrd48
    Jul 6, 2006
  3. Chris
    Replies:
    1
    Views:
    974
    Teemu Keiski
    Feb 12, 2007
  4. Andy B
    Replies:
    2
    Views:
    3,151
    Andy B
    Apr 23, 2008
  5. mmalek
    Replies:
    0
    Views:
    122
    mmalek
    Sep 5, 2007
Loading...

Share This Page