How do i: Visual Inheritance

Discussion in 'ASP .Net' started by John Blair, Jan 12, 2005.

  1. John Blair

    John Blair Guest

    Hi,

    I have one form that i want to make similar to another form but add some
    additional controls. I thought the following code would make my webform4
    have all the content of webform3 but nothing shows up in webform4.....how do
    i make this work?

    Thanks.
    Public Class WebForm4

    Inherits WebForm3
    John Blair, Jan 12, 2005
    #1
    1. Advertising

  2. In asp.net 2.0 you have Master pages. There are some 3rd party
    implementaions for 1.1. Google for something like "Master Pages for ASP.NET
    1.1"

    Eliyahu

    "John Blair" <> wrote in message
    news:_i9Fd.1224$q%...
    > Hi,
    >
    > I have one form that i want to make similar to another form but add some
    > additional controls. I thought the following code would make my webform4
    > have all the content of webform3 but nothing shows up in webform4.....how

    do
    > i make this work?
    >
    > Thanks.
    > Public Class WebForm4
    >
    > Inherits WebForm3
    >
    >
    Eliyahu Goldin, Jan 12, 2005
    #2
    1. Advertising

  3. John Blair

    John Blair Guest

    Thanks again....i thought from the vb.net documentation i could do it in
    1.1!
    "Eliyahu Goldin" <> wrote in message
    news:uhfXk1K%...
    > In asp.net 2.0 you have Master pages. There are some 3rd party
    > implementaions for 1.1. Google for something like "Master Pages for
    > ASP.NET
    > 1.1"
    >
    > Eliyahu
    >
    > "John Blair" <> wrote in message
    > news:_i9Fd.1224$q%...
    >> Hi,
    >>
    >> I have one form that i want to make similar to another form but add some
    >> additional controls. I thought the following code would make my webform4
    >> have all the content of webform3 but nothing shows up in webform4.....how

    > do
    >> i make this work?
    >>
    >> Thanks.
    >> Public Class WebForm4
    >>
    >> Inherits WebForm3
    >>
    >>

    >
    >
    John Blair, Jan 12, 2005
    #3
  4. This is not possible, because, although all of your controls are instance
    variables in the WebForm3 class, there is no rendering code in WebForm3.
    If you embed the rendering code inside of WebForm3 (probably inside of
    InitialiseComponent), by adding the controls to Page, the controls and their
    rendering will also be inherited.

    --
    Philip Q
    Microsoft MVP [ASP.NET]

    "John Blair" <> wrote in message
    news:_i9Fd.1224$q%...
    > Hi,
    >
    > I have one form that i want to make similar to another form but add some
    > additional controls. I thought the following code would make my webform4
    > have all the content of webform3 but nothing shows up in webform4.....how
    > do i make this work?
    >
    > Thanks.
    > Public Class WebForm4
    >
    > Inherits WebForm3
    >
    >
    Philip Q [MVP], Jan 12, 2005
    #4
  5. John Blair

    John Blair Guest

    Thanks a lot for the feedback....i dont understand the rendering process - i
    thought webform3 contained its own redering by default as the controls
    display for webform3 when it is say the default start page....but i take
    your word this is not possible! Thanks.

    "Philip Q [MVP]" <> wrote in message
    news:%23ZyaYHL%...
    > This is not possible, because, although all of your controls are instance
    > variables in the WebForm3 class, there is no rendering code in WebForm3.
    > If you embed the rendering code inside of WebForm3 (probably inside of
    > InitialiseComponent), by adding the controls to Page, the controls and
    > their rendering will also be inherited.
    >
    > --
    > Philip Q
    > Microsoft MVP [ASP.NET]
    >
    > "John Blair" <> wrote in message
    > news:_i9Fd.1224$q%...
    >> Hi,
    >>
    >> I have one form that i want to make similar to another form but add some
    >> additional controls. I thought the following code would make my webform4
    >> have all the content of webform3 but nothing shows up in webform4.....how
    >> do i make this work?
    >>
    >> Thanks.
    >> Public Class WebForm4
    >>
    >> Inherits WebForm3
    >>
    >>

    >
    >
    John Blair, Jan 12, 2005
    #5
  6. John Blair

    John Blair Guest

    Re: How do i: Visual Inheritance - this only works for Windows Forms not web forms.

    Hi,

    Thought about what you wrote and tried my example with windows forms - it
    works for that!
    I now see that with web forms my webform3 is the code behind class only and
    not the "HTML" part which i presume does the
    rendering so hence no display of controls when i just inherit the code
    behind class!
    Was nice to see this work with windows forms though! Thanks again!

    "John Blair" <> wrote in message
    news:JwcFd.1534$q%...
    > Thanks a lot for the feedback....i dont understand the rendering process -
    > i thought webform3 contained its own redering by default as the controls
    > display for webform3 when it is say the default start page....but i take
    > your word this is not possible! Thanks.
    >
    > "Philip Q [MVP]" <> wrote in message
    > news:%23ZyaYHL%...
    >> This is not possible, because, although all of your controls are instance
    >> variables in the WebForm3 class, there is no rendering code in WebForm3.
    >> If you embed the rendering code inside of WebForm3 (probably inside of
    >> InitialiseComponent), by adding the controls to Page, the controls and
    >> their rendering will also be inherited.
    >>
    >> --
    >> Philip Q
    >> Microsoft MVP [ASP.NET]
    >>
    >> "John Blair" <> wrote in message
    >> news:_i9Fd.1224$q%...
    >>> Hi,
    >>>
    >>> I have one form that i want to make similar to another form but add some
    >>> additional controls. I thought the following code would make my webform4
    >>> have all the content of webform3 but nothing shows up in
    >>> webform4.....how do i make this work?
    >>>
    >>> Thanks.
    >>> Public Class WebForm4
    >>>
    >>> Inherits WebForm3
    >>>
    >>>

    >>
    >>

    >
    >
    John Blair, Jan 12, 2005
    #6
    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. maxw_cc
    Replies:
    1
    Views:
    3,139
    Martijn van Steenbergen
    Dec 21, 2003
  2. cppsks
    Replies:
    0
    Views:
    821
    cppsks
    Oct 27, 2004
  3. karthikbalaguru
    Replies:
    9
    Views:
    1,037
  4. Daniel Pitts
    Replies:
    27
    Views:
    1,899
    Mike Schilling
    Feb 27, 2008
  5. johnsonlau
    Replies:
    1
    Views:
    775
    Kai-Uwe Bux
    Jul 21, 2008
Loading...

Share This Page