how to get child class "name" from parent class

Discussion in 'ASP .Net Web Controls' started by encapsul, Sep 15, 2005.

  1. encapsul

    encapsul Guest

    ..net 1.1 In a webpage I am using a base class for user controls and want to
    detect the NAME of the child class from the base class.

    As in:

    1) base class A
    2) child class "test class"
    3) child class inherits base class
    - the base class is able to detect "test class" as the class that is
    inheriting it.

    Some code for you:

    Public Class baseUserControlClass
    Inherits System.Web.UI.UserControl
    Protected Overrides Sub OnLoad(ByVal e As EventArgs)
    '... get the calling class NAME here
    ' which is "bu_basic_info" from the code below.

    Dim childControlName As String = ????
    MyBase.OnLoad(e)
    End Sub
    End Class

    --- code from the webpage---

    Public Class bu_basic_info

    Inherits prj10.baseClasses.baseUserControlClass

    ' application logic follows

    End Class
    encapsul, Sep 15, 2005
    #1
    1. Advertising

  2. encapsul

    Brock Allen Guest

    Is "Me.GetType().FullName" what you're loking for?

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen

    > .net 1.1 In a webpage I am using a base class for user controls and
    > want to detect the NAME of the child class from the base class.
    >
    > As in:
    >
    > 1) base class A
    > 2) child class "test class"
    > 3) child class inherits base class
    > - the base class is able to detect "test class" as the class that is
    > inheriting it.
    > Some code for you:
    >
    > Public Class baseUserControlClass
    > Inherits System.Web.UI.UserControl
    > Protected Overrides Sub OnLoad(ByVal e As EventArgs)
    > '... get the calling class NAME here
    > ' which is "bu_basic_info" from the code below.
    > Dim childControlName As String = ????
    > MyBase.OnLoad(e)
    > End Sub
    > End Class
    > --- code from the webpage---
    >
    > Public Class bu_basic_info
    >
    > Inherits prj10.baseClasses.baseUserControlClass
    >
    > ' application logic follows
    >
    > End Class
    >
    Brock Allen, Sep 15, 2005
    #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. davout
    Replies:
    0
    Views:
    542
    davout
    Apr 18, 2004
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,087
    David Schwartz
    Dec 9, 2003
  3. metal
    Replies:
    8
    Views:
    493
    Bruno Desthuilliers
    Oct 30, 2009
  4. Noel Dolan
    Replies:
    0
    Views:
    217
    Noel Dolan
    Jul 18, 2004
  5. Bitswapper
    Replies:
    5
    Views:
    119
    Prasad, Ramit
    Aug 27, 2013
Loading...

Share This Page