![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
How can I call a function in one UserControl from another? I have a custom sign in UserControl and another that needs to display custom information based on the sign in along the margin. I've been trying things I've found online, but can't get a definition of the class. // C# private void Successful_SignIn() { //compile error: OtherControl is not defined OtherControl control = (OtherControl)Page.FindControl("OtherControl1"); control.ShowCustomInformation(); } These controls are on a MasterPage. I have Session variables being setup in the sign in control, but apparently the 2nd control's Page_Load() is going off before the sign in control. Thanks, Steven |
#3
| |||
| |||
|
|
Okay, I was able to get it to compile this line: OtherControl control = (OtherControl)Page.FindControl("OtherControl1"); by adding: %@ Register Src="OtherControl.ascx" TagName="OtherControl" TagPrefix="uc1" % to the top of my aspx page, but now it doesn't know that the function belongs to the control: control.ShowCustomInformation(); //says 'OtherControl' does not contain a definition for 'ShowCustomInformation' Thanks, Steven How can I call a function in one UserControl from another? I have a custom sign in UserControl and another that needs to display custom information based on the sign in along the margin. I've been trying things I've found online, but can't get a definition of the class. // C# private void Successful_SignIn() { //compile error: OtherControl is not defined OtherControl control = (OtherControl)Page.FindControl("OtherControl1"); control.ShowCustomInformation(); } These controls are on a MasterPage. I have Session variables being setup in the sign in control, but apparently the 2nd control's Page_Load() is going off before the sign in control. Thanks, Steven |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |