I'm trying to programmatically set event handlers on webcontrols (must be set programmatically because the webcontrols are dynamically generated). Since the same code is used for multiple pages, I have it in a separate static class. My problem is that I want to generate the controls in the static function, but attach event handlers to these controls which actually reside in the page calling the function.
For example I have a code-behind like this:
1 protected void Page_Load(object sender, EventArgs e)
2 {
3 MakeControls();
4 }
5
6 protected void Button_Click(object sender, EventArgs e)
7 {
8 // Do something
9 }
And the static clas ...
Go to the complete details ...