posted on Thursday, July 06, 2006 12:07 AM
by
timbarcz
Page Fragment Caching problem.
I need your help!
I have a page that I'm trying to cache. This particular page is a details page for a tournament website. The tournaments run over several days. To handle the user load on the website, I'm working to implement output caching. Easy enough right? Just slap a <%@ OutputCache %> directive on the top of each user control and voila!.. done right? WRONG!
For some reason one control is simply giving me the fits. This particular control displays the schedule for a particular day. The day is selected from a drop down list which is on the user control. The AutoPostBack property is set to true. On postback the control simply does a Response.Redirect back to the details page, putting the requested day (from the dropdownlist) into the querystring so that there are two variables in the querystring, ID and day. Coincidentally enough that is what I have for my VaryByParam property, VaryByParam="ID;day". This seems to work...sometimes...and other times it doesn't. I can make it fail nearly 100% of the time if I load a particular page and then reload it using ctrl + F5. When I do a reload using ctrl + F5, any ensuing change of the dropdownlist produces a javascript "__doPostBack is not defined" error. When viewing the source, the Viewstate for the whole page is a fraction of what it was when the page was working and more importantly the __doPostBack function does not exist at all in the page anymore.
If I don't ctrl + F5 everything seems to work (I say sometimes, because at seemingly random intervals, I will get the same error). As soon as I ctrl + F5, I get the javascript error when I change the dropdownlistvalue. I don't get it. If in fact the control is cached, I should get everything back from the server including the viewstate. So what am I missing? Ideas?