Solved

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

Posted on 2006-07-07
6
1,112 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Crystal Reports 11 Ignoring Parameters 3 81
Swapping Last and First names in Crystal Reports formula 2 62
Crystal Report detail 15 49
business objects to connect to MSSQL 6 74
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

773 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