this == base ??

P

Peter Young

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
 
S

Scott G.

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

this.GetType().BaseType.FullName

Scott
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top