Problem with events and ParseControl
- by Richard Edwards
I'm adding a control (linkbutton) dynamically using ParseControl and it's fine except when I specify an event handler.
If I use:
Dim c As Control = ParseControl("<asp:LinkButton id=""btnHide"" runat=""server"" text=""Hide"" OnClick="btnHide_Click" />")
it correctly adds the control to the page but the click event doesn't fire. If instead I find the control in the controls collection and manually wire up the event it works fine. I've tried loading in both Page_Init and Page_Load and it's the same thing either way.
Any ideas?