reaching the parent

G

Guest

I want to get the parent of the user control.

PortalModuleControl portalModule = (PortalModuleControl) this.Parent;

but i get an error Specific cast is not valid.
and this is my class

public class PortalModuleControl : UserControl {

does anybody have any idea?

Thanks
 
A

Andy Fish

well it depends what "this" is set to i.e. which class you are calling it
from.

to debug it, assign this.Parent to a variable of type Object and then look
at it in the debugger. this will tell you what type of object the parent
actually is
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top