输出缓存不适用于usercontrol上的回发

时间:2013-10-01 12:10:00

标签: asp.net caching outputcache

我有一个页面,其中我有4个用户控件。其中1个用于过滤掉其他控件的内容。我在该控件中有复选框,如按性别过滤,按大小和颜色等过滤....

我在页面上添加了以下代码以进行缓存。当你像选择性别复选框一样过滤它似乎工作2-3次,它可以工作,如果你选择大小过滤器它可以工作,但如果你选择性别过滤器它不起作用,其他控制显示没有结果消息。当我知道有结果,因为它第一次起作用。

我在每个过滤器上添加一个查询字符串参数,以便我可以返回结果。

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

查询字符串

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

我试过以下但没有运气。

 <%@ 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

任何人都可以帮我这个吗?

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

1 个答案:

答案 0 :(得分:1)

在尝试寻找更好的解决方案时偶然发现了这一点 所以基本上有一个解决方法: OutputCache returns invalid version with PostBack

相关问题