Losing session state records....

wsyeager

Centurion
Joined
Apr 10, 2003
Messages
140
Location
Weston, FL
I have a webform with two listboxes. One is the parent and the other one is the child (meaning the child listbox gets populated depending on what is selected in the parent listbox).

I have one dataset that has four related datatables in it. This data gets loaded during the Page_Load event. The child table in question, has 7 records in it, of which I need to filter out a smaller subset. I tried using the DataView, which was successfull, but I needed to save this filtered data across postbacks, and you can't save a dataview in session state because it's not serializable. So, I made a copy of the original dataset, and copied just the filtered data over and then placed the dataset in session state. I then databind the child listbox with the child data.

When I click on a Submit button, this starts the postback process. In the Page_Load event during the postback, I databind the child listbox to the specific datatable within the dataset I placed in session state which works fine. Right before the end of the Page_load event, I check the number of rows in my child datatable in session state which has 5 rows. As soon as I step to the next line of code (which is inside the button handler), I check the session state of that same exact child datatable and it contains 0 rows. The session state variable is still there, but it contains 0 rows. There is no other code between the last line of code of the Page_Load event and the first line of the event handler (for the button).

Does anyone know why my child datatable would contain 5 rows during the last statement of my Page_Load event and the next line of code within the event handler all of a sudden has 0 rows? It's really puzzling me???

btw, the datasource and datamember for the listboxes are set at design time...
 
Back
Top