Home > DeveloperSection > Forums > How to get Crystal Report data in session
Mark Devid
Mark Devid

Total Post:102

Posted on    November-01-2014 12:27 AM

 PHP Crystal Report  Session 

 1 Reply(s)
 774  View(s)
Rate this:

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();
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
Royce Roy

Total Post:144

Posted on    November-01-2014 12:30 AM

I 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.

if (!IsPostBack)


 //clear session and create new session

 Session["ReportGenericList"] = null;


List<class> datasourceLst=null;


if (Session["ReportGenericList"] != null)


    datasourceLst= (List<class>)Session["ReportGenericList"];




   datasourceLst = //call methods to fill datasource

   Session["ReportGenericList"] = datasourceLst;



Don't want to miss updates? Please click the below button!

Follow MindStick