I am working with a generic list in a simple page containing a user control.
I populate this list by using Session variable. This Session variable is set in my Button_click event.
When user click on the button the session variable is set and a postback happens.The problem is that the Page_load is called before the Button_clicked event…As we know it’s the standard page’s lifecycle.
Finally,my generic List is not updated because the session variable is set after page_load.
EDIT:My session variable is set up in a function handled by a delegate on button click of my User Control.
Is there a solution to prevent this? Is there a solution to keep value of this list accross many postback withtou using session variable?
Thank you for your help,
Quentin
I find the solution: I have to override the Pre_render function of the main page.
Indeed,the lifecycle is: Page_load->Button_click->Page_PreRender.
So in my Pre_render function I can get my Session variable setted up and use it as I want.
From what I understood,the Pre_Render event is often used for initializing value of controls just before they are displayed on the Page.
Thank you for your help.