Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Raise event in web user control to parent web user control

Status
Not open for further replies.

IlseDC

Programmer
Mar 24, 2003
49
0
0
BE
I have a web user control UC1.ascx.
This web user control has another web user control on it UC2.ascx.
When a button in UC2 is clicked there has to be raised an event in UC1 and the content of a textbox of UC2 has to be available in UC1.
Is there anyone who has an example in C# of raising events?

Thanks.
Ilse
 
User Control
Code:
//Delegate to let the container page know a toolbar button has been clicked		
public delegate void PrintEventHandler();
public event PrintEventHandler PrintEvent;

Code:
private void reportingMenu_ItemSelected(object sender, EventArgs e)
{
  PrintEvent();
}

Consumer
Code:
//Toolbar delgates //
NewReportingToolbar.PrintEventHandler PrintHandler = new NewReportingToolbar.PrintEventHandler(OnPrint);

NewReportingToolbar1.PrintEvent += PrintHandler;

Code:
private void OnPrint() {
  DoSomething();
}

HTH

Smeat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top