G
Guest
Hi Ther
I have an ASP.NET user control which contains a test panel defined as follows
<aspanel ID="TestPanel" Runat="server" /
In the OnInit method I designate an event handler to handle the user controls PreRender event and in the PreRender event handler I create a button as follows
Button _Button = new Button()
_Button.ID = "PRButton"
_Button.Text = "Pre-Render Test"
_Button.Click +=new EventHandler(_Button_Click)
TestPanel.Controls.Add(_Button)
If I add similar code into the Page_Load, the button event successfully fires and is captured by the _Button_Click event handler
However if I click on the button added within the PreRender event handler the debugger steps into the Page_Load and PreRender event handlers but ignors the Button Click event handler
Can any one tell me why this is and also how I can potentially solve this problem
Simply moving the code into the Page_Load is not an option, I have other code that must remain within the Pre_Render event handler
Thank
Doug
I have an ASP.NET user control which contains a test panel defined as follows
<aspanel ID="TestPanel" Runat="server" /
In the OnInit method I designate an event handler to handle the user controls PreRender event and in the PreRender event handler I create a button as follows
Button _Button = new Button()
_Button.ID = "PRButton"
_Button.Text = "Pre-Render Test"
_Button.Click +=new EventHandler(_Button_Click)
TestPanel.Controls.Add(_Button)
If I add similar code into the Page_Load, the button event successfully fires and is captured by the _Button_Click event handler
However if I click on the button added within the PreRender event handler the debugger steps into the Page_Load and PreRender event handlers but ignors the Button Click event handler
Can any one tell me why this is and also how I can potentially solve this problem
Simply moving the code into the Page_Load is not an option, I have other code that must remain within the Pre_Render event handler
Thank
Doug