This is a migrated thread and some comments may be shown as answers.

Filtering data without retrieving the data every time

2 Answers 41 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris McGrath
Top achievements
Rank 1
Chris McGrath asked on 24 Feb 2010, 11:09 PM
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 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 26 Feb 2010, 02:48 PM
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.
0
Mark Galbreath
Top achievements
Rank 2
answered on 26 Feb 2010, 03:01 PM
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
Tags
Grid
Asked by
Chris McGrath
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Mark Galbreath
Top achievements
Rank 2
Share this question
or