I have usercontrol in my page loaded using Page.Controls.Add(ctrl)
Now, I have button in that user control and want to fire one function when user clicks on that user control’s button.
I have that user control on lots of pages and want to fire different function on that button click of user control.
In general you should communicate from your
UserControlsto thePagesvia Events. So declare a custom event in the UserControl that’ll be raised in the button-click handler and can be handled by the page. On this way every page using this control can react differently.http://www.codeproject.com/Articles/8797/Mastering-Page-UserControl-Communication#4.3