Filtering data without retrieving the data every time

3 posts, 0 answers
  1. Chris McGrath
    Chris McGrath avatar
    23 posts
    Member since:
    Dec 2009

    Posted 24 Feb 2010 Link to this post

    Hi,

    I'm very new to the telerik controls so assume I know nothing when answering this question. =)

    I have a dataset that takes a long time to populate.  Let's say it takes 30 seconds.  Once this data is populated, I want the user to be able to filter, sort, etc. but every time the filter is changed, it goes to the database and spends 30 seconds retrieving the data all over again.  I should mention that I am using the NeedDataSource function to populate the data, because when I did simple binding, I could not get the filtering to work at all.

    Am I missing something basic?  Shouldn't there be a way to apply a filter to the grid that doesn't require another pass at the database?

    Thanks in advance,

    Chris
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 26 Feb 2010 Link to this post

    Hi Chris,

    In order to achieve your goal you could save the data in session, ViewState or Cache(depending on the scope of the data).

    Attached to this message is a simple working application which handles the desired functionality. Give it a try and let me know if it works for you.

    I hope this gets you started properly.

    All the best,
    Pavlina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark Galbreath
    Mark Galbreath avatar
    171 posts
    Member since:
    Jul 2009

    Posted 26 Feb 2010 Link to this post

    Chris,

    In my Page_Load sub/method, I have
    VB
    If Application( "lins_table" ) Is Nothing Then Application( "lins_table" ) = dao_LIN.get_LINs_Table() 

    C#
    if( Application[ "lins_table" ] == null ) { Application.Add( "lins_table",dao_LIN.get_LINs_Table()); }
    if !isCallback, where I have a data access object query the database and pass back a DataTable object.

    And in NeedDataSource
    VB  
    radGrid1.DataSource = Application( "lins_table" )  
     
    C#  
    radGrid1.DataSource = Application[ "lins_table" ]; 

    Application scope is great if the data is static.  If the data rarely changes, Session scope works.  But if you are allowing users to change the data in real-time, you must go to the database with every refresh (rebind) event.

    Cheers!
    Mark
Back to Top