T
Tarun Mistry
Hi all, I am adding dynamic user controls with the simple code as follows:
MyPlaceHolder.Controls.Add(LoadControl("MyUserControl.ascx"));
I then want to run a member on my user control, something like:
MyPlaceHolder.Controls.TheMemberFunction();
However I cannot do this as it obviously has not cast the User Control to
its own type and therefore cannot reference the member function.
How can i cast my User Control into the "MyUserControl" before adding it
into the controls array for the place holder (or after for that matter?).
Any attemps sees error along the lines of "A control cannot be case to
UserControl".
Thank you for any help.
Kind Regards
Tarun
MyPlaceHolder.Controls.Add(LoadControl("MyUserControl.ascx"));
I then want to run a member on my user control, something like:
MyPlaceHolder.Controls.TheMemberFunction();
However I cannot do this as it obviously has not cast the User Control to
its own type and therefore cannot reference the member function.
How can i cast my User Control into the "MyUserControl" before adding it
into the controls array for the place holder (or after for that matter?).
Any attemps sees error along the lines of "A control cannot be case to
UserControl".
Thank you for any help.
Kind Regards
Tarun