Hello all,
I have used almost all means as to prevent caching of datagrid on one of
my forms. Still, it is being cached. What am I doing wrong and why the
thing keeps caching the page? It's set up in the following manner - in
one small form user enters some value and then another form opens, that
in Page_Onload acceses the DB and pulls data relevant to value entered.
Here's what I have on my page (don't blame me, I was trying to do it all
the ways it is possible):
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="ResultGrid.aspx.vb" Inherits="Reporter.ResultGrid"
buffer="False" enableViewState="False"%>
<%@ OutputCache Duration="2" VaryByParam="none" Location="None"%>
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Response.Buffer = False
Response.Cache.SetMaxAge(CType(, System.TimeSpan))
HttpContext.Current.Response.Cache.SetCacheability (HttpCacheability.NoCa
che)
If Not IsPostBack Then
drawPage()
End If
End Sub
Public Sub drawPage()
Dim query As String
If Cache("query") Is Nothing Then
// some DB connection code and grid drawing //
Else
Dim i As Integer = 0
Dim s As System.Collections.DictionaryEntry
'Server.Transfer("ResultGrid.aspx")
For Each s In Me.Cache
Me.Cache.Remove(s.Key.ToString)
i += 1
Next
HttpContext.Current.Response.Cache.SetCacheability (HttpCacheability.NoCa
che)
drawPage()
End If
End Sub
*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!