I have a custom object in a session that is updated using postbacks on both the main page and the main page.
After the postback, I need to get the Session object, rebuild and change parts or all of the object, and load it back into the session.
I wrote this code in Page_Load of the main page. It works fine on only one page.
Now I have written another page with the same main page, and I want the main page to be able to modify my session object as before.
Therefore, it seemed to me that I just needed to move the session processing code to the main Page_Load page. But this did not work as I expected, since the control on the main page (namely, the relay) accesses the session object in the OnItemDataBound event handler before the Page_Load master page is launched, and thus it receives only the previous state of the session object, (This is true only for the repeater on the main page, the repeater on the main page receives the current state when it accesses the session)
Regardless, I thought I could use the Page_PreLoad event of the main page, I could access the postback data in Page_PreLoad just as well, and update the session object accordingly, but I found that there was no Page_PreLoad page on the main page, or I can not use it.
Where should I update my object in a session?
To summarize: I need a place in the masterpage codebehind where the postback data is ready for use, and not one of the main page or MasterPage OnItemDataBound repeater event has yet been triggered.
source share