I have a custom control that is dynamically added to a web page based on a search/sort that the user runs. This is triggered by a button, at which point the controls are created and data populated. The display of this data is functional, however this custom control contains a button. After reading up on the lifecycle of the page, I realized that everything associated with the dynamic control is lost after a postback, and that the event is not raised until page_load has occurred. Therefore, my button that triggered the postback disappeared into the ether before the ASP .Net Engine looked at the event.
My question is, is there a way to dynamically create this control and being able to access the events? Even if I put the data in the ViewState, and reload the control each Page_Load, the event data will be gone right, because the 'sender' ceases to exist? Is this approach I'm trying to take a dead end? Thanks in advance.
View Complete Post