Solved

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

Posted on 2006-07-07
6
1,158 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

623 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