We help IT Professionals succeed at work.

ObjectDataSource Caching & Filtering

espadana asked
Last Modified: 2013-11-05
Hi,  I have been stock on this issue for a while now, and would be very gratful if you could help.

I am binding an Objectdatasource to a gridview to display some data.  I have letters A-Z as linkbuttons on top of the gridview, so that when user clicks a letter, the data in gridview is filtered and only those starting with that letter are shown.  The ODS cache duration is set to 360 seconds.

I have managed to get caching and filtering to work on their own, but not together.  When both are used,  and I click on a letter to filter the data, the code always calls the function to get data from database, and does not use cached data (i.e. I am trying to filter the data cahced in the ODS). below is the code for my ODS:

<asp:objectdatasource id="ObjectDataSource1" runat="server" CacheDuration="360" EnableCaching="True" selectmethod="GetFeedData" typename="DataFunctions" FilterExpression="Name LIKE '{0}%'">
    <asp:Parameter Name="SearchID" DefaultValue="502185" Type="int32"  Direction="Input" />
    <asp:Parameter Name="FilterID" DefaultValue="502186" Type="int32"  Direction="Input" />
    <asp:Parameter Name="CompanyID" Type="int32"  Direction="Input" />
     <asp:Parameter Name="PagingLetter" DefaultValue="A" Type="string" Direction="Input" />
       <asp:Parameter Name="Paging" Type="String" DefaultValue="A" />
Watch Question

This one is on us!
(Get your first solution completely free - no credit card required)


Thanks alot for the link.

Although the information is useful, it does not seem to address the issue im having.  I am not fiddling with cachekeydependency or trying to manually remove cache from ODS.  I just want to be able filter what is already cached on the ODS.

Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.