Code behind of a user control:
public event System.EventHandler CertainEventOccured;
Fire it when this event occurs like follows;
if(this.CertainEventOccured != null){
this.CertainEventOccured(this, new EventArgs());
}
Code behind of the page:
Wire up the the event like;
this.MyControl.CertainEventOccured += new EventHandler(MyControl_CertainEventOccured);
And finally define the function that will run when this event is fired.
private void MyControl_CertainEventOccured(object sender, EventArgs e) {
//your logic goes here
}
No comments:
Post a Comment