My team and I have developed a sharepoint application using smartpart and usercontrols. The problem is that I would like to load and navigate through those controls from other web part by calling a control class method. As shown below:
UserControl uc = (UserControl)this.Page.LoadControl("~/usercontrols/ProgramasSociaisView.ascx");
HiddenField txtPSEUO = (HiddenField)uc.FindControl("txtCD_PSEUO");
txtPSEUO.Value = "1";
((ProgramasSociaisView)uc).viewProgram(); <== Unable to cast object
of type 'ASP.usercontrols_programassociaisview_ascx' to type 'Webparts.UI.ProgramasSociaisView'.
Can anyone give me a clue on that? I know I can't cast that object. Is there any other way to call that control class (*.ascx.cs) method?
Thanks in advance for any help.