HighTechTalks DotNet Forums  

Issues with caching after the browser has been closed

ASP.net Caching microsoft.public.dotnet.framework.aspnet.caching


Discuss Issues with caching after the browser has been closed in the ASP.net Caching forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Neil Cooper
 
Posts: n/a

Default Issues with caching after the browser has been closed - 01-25-2005 , 12:14 PM






Hi

Not sure if this the right group or not but here it goes.

Here is a part excerpt of my code in the Page_Load Event

'Create cache if the cache object doesn't exist yet
If IsNothing(Cache.Get("dsAllResults")) Then

' Use various SelectCommand to fill the 4 SqlAdapters

' Add all tables to a single data set
dsAllResults.Tables.Add(Client)
dsAllResults.Tables.Add(Calendar)
dsAllResults.Tables.Add(Result)
dsAllResults.Tables.Add(Remedy)

' Cache Data Set for 5 minutes
Cache.Add("dsAllResults", dsAllResults,
Nothing, DateTime.MaxValue, _
System.TimeSpan.FromMinutes(intCacheTimeout), _
Caching.CacheItemPriority.Default, Nothing)
Else
dsAllResults = Cache("dsAllResults")

End If
If Not (IsPostBack) Then
' Bind the client dropdown
drpClient.Items.Clear()

If Not (drpClient.SelectedItem Is Nothing)
Then
drpClient.SelectedItem.Text = ""
drpClient.SelectedItem.Value = ""
drpClient.SelectedItem.Selected = False

End If

drpClient.DataSource = dsAllResults.Tables
("Client")
drpClient.DataValueField = "ClientID"
drpClient.DataTextField = "Name"
drpClient.DataBind()
drpClient.Items.Insert(0, "")

End If
End Sub

This all works fine and has made the page run much
faster , the problem i have is if some one has shut the
browser down and they re-open it again.

The page loads again and opens from the cache fine but
when it gets to this point things go funny.

drpClient.DataSource = dsAllResults.Tables("Client")
drpClient.DataValueField = "ClientID"
drpClient.DataTextField = "Name"
drpClient.DataBind()
drpClient.Items.Insert(0, "")

Up until drpClient.DataBind() everything is fine, as soon
as stepped over drpClient.DataBind() the drpClient
already has the following properties already set.

drpClient.SelectedItem.Text = "Client Name"
drpClient.SelectedItem.Value = "156"
drpClient.SelectedItem.Selected = True

These are always the last selected client from the drop
down even after the browser is shut.

Has anybody had anything like this before , is the
autopostback on the dropdown updating the cache in
anyway , i'm at my wits end on this.

If anybody can help it would be most appreciated.


Thanks & Regards




Neil Cooper



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.