Web UserControl and Visual Inheritance

Discussion in 'ASP .Net' started by Ben Fidge, Jun 8, 2004.

  1. Ben Fidge

    Ben Fidge Guest

    Hi

    I have a situation where it would be very advantageous to
    be able to derive a new web UserControl from an existing
    one, making the bases server controls available to the
    derived class (and therefore, visible to the user).

    I know how to derive from a base class so that common
    code is available to the derived class, but I need to UI
    elements to be visible in the new usercontrol too.

    Any ideas?

    Ben
    Ben Fidge, Jun 8, 2004
    #1
    1. Advertising

  2. Ben Fidge

    Oleg Ogurok Guest

    I believe that's impossible.
    When you execute a page (view it in browser), your ASPX or ASCX content is
    transformed into a classon the fly. This class is always inherited from the
    codebehind (.cs).
    As far as I know, you can't derive from ASPX or ASCX. Therefore you can't
    create a derived user control that would include the visual parts of the
    base one.
    Your only choice is to add your controls programmatically in the codebehind
    of the base class, and then inherit.

    -Oleg.


    "Ben Fidge" <> wrote in message
    news:1984c01c44d36$fcf27f60$...
    > Hi
    >
    > I have a situation where it would be very advantageous to
    > be able to derive a new web UserControl from an existing
    > one, making the bases server controls available to the
    > derived class (and therefore, visible to the user).
    >
    > I know how to derive from a base class so that common
    > code is available to the derived class, but I need to UI
    > elements to be visible in the new usercontrol too.
    >
    > Any ideas?
    >
    > Ben
    Oleg Ogurok, Jun 8, 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. ThunderMusic
    Replies:
    4
    Views:
    411
    ThunderMusic
    Dec 21, 2005
  2. Yuan
    Replies:
    1
    Views:
    3,121
    Scott Allen
    Jan 26, 2006
  3. Replies:
    0
    Views:
    462
  4. Kan Grewal

    Web Usercontrol in a Web Usercontrol not displaying...

    Kan Grewal, Jul 6, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    112
    Kan Grewal
    Jul 7, 2004
  5. Ivan A. Vasilyev

    Web UserControl inheritance

    Ivan A. Vasilyev, Jun 21, 2007, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    159
    Ivan A. Vasilyev
    Jul 2, 2007
Loading...

Share This Page