Solved

ObjectDataSource caching data

Posted on 2008-10-21
4
421 Views
Last Modified: 2013-12-17
I have a search page with a gridview populated with an objectdatasource. When a link in the gridview is clicked it navigates to the update page. Once the update page is open, i have a cancel button which takes the user to the previous page, javascript:history(-1). If data on the update page is saved to the database and the cancel button is pressed and the search page is open. When you click search the new data in the database doesnt appear, but if you select the search page from the menu or hit f5 then do a search the data appears. The object data source is caching the data and i have it turned off:

<asp:ObjectDataSource EnableCaching="false" CacheDuration="0" CacheExpirationPolicy="Sliding" ID="dataSource" runat="server"
                 OldValuesParameterFormatString="{0}"
                    SelectMethod="GetCustomerFacilityCSV"
                    TypeName="CustomerClass" >

How do i make the data source stop caching data when the page is reached through javascript:history(-1)?
0
Comment
Question by:troycomp
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:trunghieubkit
ID: 22772926
Replacing
CacheDuration="0"
by
CacheDuration="60"

it means 60 seconds
or what number you want, it is time that cache is alive,
0
 
LVL 3

Expert Comment

by:trunghieubkit
ID: 22772933
More one,

replacing

<asp:ObjectDataSource EnableCaching="false" CacheDuration="0" CacheExpirationPolicy="Sliding"

by

<asp:ObjectDataSource EnableCaching="true" CacheDuration="60"


0
 

Author Comment

by:troycomp
ID: 22772937
Isnt setting CacheDuration="0" telling it to keep the cache alive for 0 seconds? And EnableCaching="false" so im confused
0
 

Accepted Solution

by:
troycomp earned 0 total points
ID: 22773606
Also if the user right clicks on the page and then clicks "Back" i get the same results. Why isnt the object datasource hitting the database?
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error in query expression 3 36
ASP.NET 5 Templates 2 66
Error on link 14 38
ASP.net VB.net Highlight html text in yellow in body of email 5 7
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now