this == base ??

Discussion in 'ASP .Net Web Controls' started by Peter Young, Aug 11, 2004.

  1. Peter Young

    Peter Young Guest

    I'm trying to access the Attributes of a base control, but am seeing something strange.

    In this simple example:

    namespace WebControlLibrary1
    {
    public class WebCustomControl1 : System.Web.UI.WebControls.ImageButton
    {
    protected override void Render(HtmlTextWriter output)
    {
    System.Diagnostics.Debug.WriteLine(base.GetType().ToString());
    System.Diagnostics.Debug.WriteLine(this.GetType().ToString());
    base.Render(output);
    }
    }
    }

    The output of the debug writes is as follows:

    WebControlLibrary1.WebCustomControl1
    WebControlLibrary1.WebCustomControl1

    I expected to see something like this:

    System.Web.UI.WebControls.ImageButton
    WebControlLibrary1.WebCustomControl1

    How do I access the base ImageButton control?

    TIA,
    Pete
     
    Peter Young, Aug 11, 2004
    #1
    1. Advertising

  2. Peter Young

    Scott G. Guest

    You should use the Type object of the object you are interested in to see the base class; try

    this.GetType().BaseType.FullName

    Scott
    "Peter Young" <> wrote in message news:ePLwDK%...
    I'm trying to access the Attributes of a base control, but am seeing something strange.

    In this simple example:

    namespace WebControlLibrary1
    {
    public class WebCustomControl1 : System.Web.UI.WebControls.ImageButton
    {
    protected override void Render(HtmlTextWriter output)
    {
    System.Diagnostics.Debug.WriteLine(base.GetType().ToString());
    System.Diagnostics.Debug.WriteLine(this.GetType().ToString());
    base.Render(output);
    }
    }
    }

    The output of the debug writes is as follows:

    WebControlLibrary1.WebCustomControl1
    WebControlLibrary1.WebCustomControl1

    I expected to see something like this:

    System.Web.UI.WebControls.ImageButton
    WebControlLibrary1.WebCustomControl1

    How do I access the base ImageButton control?

    TIA,
    Pete
     
    Scott G., Aug 12, 2004
    #2
    1. Advertising

  3. Peter Young

    Peter Young Guest

    "Scott G." <> wrote in message news:Oui%...
    > You should use the Type object of the object you are interested in to see the base class; try
    >
    > this.GetType().BaseType.FullName


    Thx.
     
    Peter Young, Aug 12, 2004
    #3
    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.

Share This Page