I have noticed that crystal report runs the Linq query once again when the page index is changed, means when we load second page from first page? So just wanted to know if we can get which page is loaded so that we can keep values in session.
Just a hint is required as I am not getting the desired results from Google.
Update: I am sorry in a hurry I just clicked on a wrong tag. So the problem is like:
This is my code below which I use fr running my crystal report:
var rpt = new Result(); List<class> lst1 = new DALMethod().Get(); rpt.SetDataSource(lst1); CRReportViewer.ReportSource = rpt;
When I switch from page one to two or more, this method in DAL is called again taking the same time it took first time to load, so I just want to have the data in session when query runs first time, and next time when I get the page index, then I will show data from session.
Is there a way around by which I can get the page index in this c# code?
Royce Roy
01-Nov-2014I had found the solution, hope this might help someone else: I was using a generic list as a data source:
1. As soon as we get to know the page loads for the first time, I mean not a postback, we can initialize a list to be maintained in session.
2. After showing the report we can add the data source (which is a list type).
3. On Report page shift data will be taken from session.