Solved

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

Posted on 2006-07-07
6
1,092 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 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

18 Experts available now in Live!

Get 1:1 Help Now