patel.milanb
patel.milanb

Reputation: 5992

Output cache does not work with postback on usercontrol

I have a page in which i have 4 user control. 1 of them is used to filter out the the contents of the other control. I have checkboxes in that control like filter by gender, filter by size and color etc....

I have added the following code on my page for caching. it seems to work 2-3 times when you filter it like select genders checkbox and it works, if you select size filter it works, but again if you select gender filter it does not work and other control shows no results message. when i know there are results because first time it did work.

I am adding a query string parameter on each filters so that i can get the results back.

<%@ OutputCache Duration="300"  VaryByParam="*"  %>  

Query string

http://somwsite.com/jacktes/?n=0&lp=&hp=&size=&colour=&g=MENS

I have tried the following with no luck.

 <%@ OutputCache Duration="300"  VaryByParam="none" VaryByControl="GenderFilter" %> 
 <%@ OutputCache Duration="300"  VaryByControl="GenderFilter" %> // ID of the checkbox List
 <%@ OutputCache Duration="300"  VaryByParam="n;lp;hp;size;colour" %> // ID of the querystring param

can anyone please help me with this?

Note: No error message as page works fine BUT out of 4 control the control which shows the filter results is displaying no results.

Upvotes: 0

Views: 333

Answers (1)

Gabriel
Gabriel

Reputation: 635

stumbled on this while trying to find a better solution so basically there is a workaround: OutputCache returns invalid version with PostBack

Upvotes: 1

Related Questions