reaching the parent

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top