Hi, I have a site and I notice that on pages with update panels, the page cache does not reflect user changes to controls in the panel. So if you make drop-down list selections, then move to another page, when you click "back" all the changes are lost.
However when I take out the update panel (turn off javascript version of the page), all controls are remembered for their state when navigating back to the page.
It seems to me the page cache works fine without the update panels in place, because a postback occurs without the update panel so the page cache has this data in place. Yet with the update panel, the page cache is only loaded initially and so doesn't reflect
user changes when navigating back.
I'm sorry to be long-winded. Can anyone point me in the direction to force the page to cache when I click a button to navigate away from the page, so the update panel state is retained in the cache when navigating back?
Thanks for the support. I'm not a total newbie, but close.
EDIT: I should add, when I turn off the cache in code behind, the browser simply gives "page has expired" notice and this is totally frustrating as an end-user experience. I am using session variables to load data on the page, but this doesn't seem to matter.
Surely there is a .net command to tell the browser to cache the page state when a button is clicked in an update panel?
I have discovered the Scriptmanager history but it seems to work rather clunkily, requiring to add each control value to history state and then reload it...it still shows the old page for a second and looks amateurish.
What do professional developers to do retain control states within update panels when dealing with the browser back/forward button?
Thank-you.
EDIT: here's the article about the history state stuff...
philllmj
Member
17 Points
25 Posts
How To Cache with Update Panel?
Feb 22, 2013 08:30 PM|LINK
Hi, I have a site and I notice that on pages with update panels, the page cache does not reflect user changes to controls in the panel. So if you make drop-down list selections, then move to another page, when you click "back" all the changes are lost.
However when I take out the update panel (turn off javascript version of the page), all controls are remembered for their state when navigating back to the page.
It seems to me the page cache works fine without the update panels in place, because a postback occurs without the update panel so the page cache has this data in place. Yet with the update panel, the page cache is only loaded initially and so doesn't reflect user changes when navigating back.
I'm sorry to be long-winded. Can anyone point me in the direction to force the page to cache when I click a button to navigate away from the page, so the update panel state is retained in the cache when navigating back?
Thanks for the support. I'm not a total newbie, but close.
EDIT: I should add, when I turn off the cache in code behind, the browser simply gives "page has expired" notice and this is totally frustrating as an end-user experience. I am using session variables to load data on the page, but this doesn't seem to matter. Surely there is a .net command to tell the browser to cache the page state when a button is clicked in an update panel?
philllmj
Member
17 Points
25 Posts
Re: How To Cache with Update Panel?
Feb 24, 2013 01:22 AM|LINK
Bump - surely this is a common issue?
I have discovered the Scriptmanager history but it seems to work rather clunkily, requiring to add each control value to history state and then reload it...it still shows the old page for a second and looks amateurish.
What do professional developers to do retain control states within update panels when dealing with the browser back/forward button?
Thank-you.
EDIT: here's the article about the history state stuff...
http://rchern.wordpress.com/2008/05/11/updatepanel-backforward-browser-navigation/