Customer event is very easy from Web User Controls.
Just 4 steps of code for this!
1) Declare event in the user control
2) Fire that event form user controls event.
(like button click event in that control.)
3) Now asign that event in Page_OnInit event for that control.
Just 4 steps of code for this!
1) Declare event in the user control
public EventHandler AddNew;
2) Fire that event form user controls event.
if (AddNew != null)
AddNew(sender, e);
(like button click event in that control.)
3) Now asign that event in Page_OnInit event for that control.
protected override void OnInit(EventArgs e)
{
myUserCotrol1.AddNew = new EventHandler(MyNewEventMethod);
}
protected void MyNewEventMethod (object sender, EventArgs e)
{
//Some code;
//Some code;
}
Thanks dude.. its worked for me....
ReplyDelete