Solved

prevent the load event of asp.net when click next button of crystal report viewer

Posted on 2006-07-07
6
1,105 Views
Last Modified: 2011-04-14
Hi Experts

these days i am facing weird problem. I am using crystal report 11 with asp.net. The problem is when i click on next button of crystal report page, my asp page call Page_Load event and it takes several minutes to move on next page. Can we prevent the load event of the page?

Thanks,
ahmad
0
Comment
Question by:imrancs
  • 3
  • 3
6 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 17060431
No, you cannot prevent the load event of the page - this is a windows generated event message that your application code can handle, but cannot prevent.

Commonly you would use a postback check in your OnLoad event to deal with this situation:

If not Page.IsPostBack Then
  'do all of your time consuming stuff here
End If


Is there a reason you can't use that practice?
0
 
LVL 10

Author Comment

by:imrancs
ID: 17070927
Hi Frodoman

If i put all my code in above condition then page does not load report on next click button of viewer. becuase we loses all previous values of report objects and we again need to provide all values to these objects. when we use agex in datagrid then it will not load data from server on next page of grid. same thing i want to use in crystal report.
can i do this or not.

Thanks,
Ahmad
0
 
LVL 42

Expert Comment

by:frodoman
ID: 17072829
Try something like this:

If not Page.IsPostBack Then
  MyReportDoc = New Report1
  Session("CachedReport") = MyReportDoc
Else
  MyReportDoc = Session("CachedReport")
End If

MyReportViewer.Source = MyReportDoc


I don't have VS open so I'm doing syntax from memory.  The key is that the first time the page loads you instantiate your report normally, then you copy the reportdocument object to your session.  On every subsequent load you copy the object from the session into your reportdocument object before pointing your viewer to it.

HTH

frodoman
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 10

Author Comment

by:imrancs
ID: 17079251
HI frodoman

I was already thinking to use session but there is memory problem because we have lots of reports in our application if i use only one session for all reports then we get one problem is that if any user open 3 or 4 reports at a time and user click the next button of the first open report then it shows last open report data because now session contain last open report object. solution is that take a different session of all reports but it creates memory issue. so i leaves this solution then i tried serriallizable concept save a object in file with respect to user and reports and then use it. this solution dont take memory. but i need to know i am using a best solution for this or need something else.
very urgent

thanks,
ahmad
0
 
LVL 10

Author Comment

by:imrancs
ID: 17079455
As an alternative of session, i've tried to serialize to reportDocument. but the ReportDocument Object is serialized successfuly but on deserialization it throws exception:

Deserialization failed.  You need to run rassdk

But RAS license is very costly. is there any alternative of this.

0
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 17081711
I don't know of an RAS license alternative.  

You might be able to somewhat mitigate the memory requirements by storing a dataset in the session instead of the entire report - you would then make sure you're using the push method to pass the cached dataset to the report every time the page loads.  Whether or not this saves memory and/or is faster is going to be a case-by-case basis depending on the amount of raw data, the amount of final parsed data, and the complexity of the report rendering.

It is certainly a trade-off.  You save the memory by sacrificing the speed (which is where you started the question).  I use session to store a small percentage (maybe 5%) of my asp.net crystal reports - it just isn't worth the memory cost most of the time but with a few that take exceptionally long to render it is worthwhile.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Crystal Report Error 14 73
Dynamic Image won't display if no data is returned 11 50
Crystal Reports - Trim Data 7 42
Crystal Reports last day of month 2 44
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now