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

[Solved] Easy way to retrieve grid's data after postback

2 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel Cai
Top achievements
Rank 1
Daniel Cai asked on 10 Jun 2008, 02:13 AM
This may seem very simple question, but I did a little search on the forum, and could not find any existing sample.

I have a grid populated with data when page loads. I also have a Generate Report button on the same page. When use clicks the button, I want to get the data from the data grid itself directly (actually what I bind to the grid is a collection of domain objects) without talking to database again, and send the object collection to Telerik Reporting component to generate a new report.

The main initiative is to avoid talking to database repetitively as it is a quite expensive call which involves a number of table joins and may return hundreds of records.

Does anyone know an easy way for this?

Thanks,
Daniel

2 Answers, 1 is accepted

Sort by
0
Daniel Cai
Top achievements
Rank 1
answered on 10 Jun 2008, 06:47 PM
Is there any efficient way to do this other than storing the whole object collection in session variable?

Anyone from telerik can help me?

Thanks,
Daniel
0
Sebastian
Telerik team
answered on 12 Jun 2008, 11:50 AM
Hi Daniel,

You can store the collection of domain objects in Cache/ViewState object and retrieve it from there when you click the Report button to generate a report. The other option you already discovered is to store the source in the Session. Thus you will avoid hitting the database each time the data has to be bound in the grid and assign the data source for the control wiring its NeedDataSource event.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
Daniel Cai
Top achievements
Rank 1
Answers by
Daniel Cai
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or