Solved

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

Posted on 2006-07-07
6
1,131 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
Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

751 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