This problem can be solved by creating a custom event in UC2 and consuming that event on the main page to invoke the hide method on UC1.
You declare a delegate in your user control
public delegate void HideTextBoxEventHandler(object sender, EventArgs e);
Then define the event for the delegate you created
public event HideTextBoxEventHandler HideTextBox;
At the point in the code where you want to hide text box you need to invoke that event:
if (this.HideTextBox != null) // if there is no event handler then it will be null and invoking it will throw an error.
{
EventArgs e = new EventArgs();
this.HideTextBox(this, e);
}
Then from the main page create an event handling method
protected void UserControl2_HideTextBox(Object sender, EventArgs e)
{
UC1.InvokeHideTextBox(); // this is the code in UC1 that does the hiding
}
You will need to add to the page load or where ever you are loading UC2
UC2.HideTextBox += new UserControl2.HideTextBoxEventHandler(this.UserControl2_HideTextBox);