on 12-20-2010 10:14 AM
Hi
i have some questions about client control of the report viewer. I would want to use some custom buttons in order to use the report viewer functionalities, as an example to print, or to known when a customer leaf through the report pages saving something in a javascript variable.
Is it possible to interact with the report viewer? There is a reference text?
Thanks
I've never done it with JavaScript, but you could use the built in events to keep track of some information about report navigation. Some of the available events are below.
CrystalReportViewer Events
Description
CrystalReportViewerBase.AfterRender Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the report rendering process is finished.
CrystalReportViewerBase.AfterRenderContent Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the report content rendering process is finished.
CrystalReportViewerBase.AfterRenderObject Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the report object rendering process is finished.
CrystalReportViewerBase.BeforeRender Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the report rendering process starts.
CrystalReportViewerBase.BeforeRenderContent Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the report content rendering process starts.
CrystalReportViewerBase.BeforeRenderObject Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the report object rendering process starts.
CrystalReportViewer.Drill Event
Event fires when a report is drilled down on.
CrystalReportViewer.DrillDownSubreport Event
Event fires when the user drills down on a subreport.
CrystalReportViewerBase.Error Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the report object throws an exception.
CrystalReportViewer.Navigate Event
Event fires when the user navigates through a report.
CrystalReportViewerBase.OnRenderScript Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the HTML script generation starts.
CrystalReportViewerBase.OnRenderStyle Event
(Inherited from CrystalReportViewerBase Class.) Event fires when the HTML style class generation starts.
CrystalReportViewerBase.ReportPartBookmarkNavigation Event
(Inherited from CrystalReportViewerBase Class.) Event fires after navigation to a report part in the same report or another report is finished.
CrystalReportViewer.ReportRefresh Event
Event fires when the data in the report is refreshed.
CrystalReportViewer.Search Event
Event fires when text is searched for in the report.
CrystalReportViewer.ViewZoom Event
Event fires when zoom level of the viewer changes.
CrystalReportViewerBase Events
Description
CrystalReportViewerBase.AfterRender Event
Event fires when the report rendering process is finished.
CrystalReportViewerBase.AfterRenderContent Event
Event fires when the report content rendering process is finished.
CrystalReportViewerBase.AfterRenderObject Event
Event fires when the report object rendering process is finished.
CrystalReportViewerBase.BeforeRender Event
Event fires when the report rendering process starts.
CrystalReportViewerBase.BeforeRenderContent Event
Event fires when the report content rendering process starts.
CrystalReportViewerBase.BeforeRenderObject Event
Event fires when the report object rendering process starts.
CrystalReportViewerBase.Error Event
Event fires when the report object throws an exception.
CrystalReportViewerBase.OnRenderScript Event
Event fires when the HTML script generation starts.
CrystalReportViewerBase.OnRenderStyle Event
Event fires when the HTML style class generation starts.
CrystalReportViewerBase.ReportPartBookmarkNavigation Event
Event fires after navigation to a report part in the same report or another report is finished.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One of my first questions is "Why are you trying to do this? What business problem are you attempting to solve by adding this type of tracking?"
You can accomplish your goal with paging through the report by using the Navigate event. As for the Print button, I don't think we have an event for that so it would be more difficult.
We don't have any public API for the JavaScript we use. It has gotten more and more complex over the years as we've added more features to the viewer. You found that we use MochiKit in the back end. Your best bet is to explore the events we've exposed for the viewer.
If you don't find one that you need I suggest you visit the [Idea Place|http://www.sdn.sap.com/irj/scn/idea-place] and submit your suggestion. Of course, search to see if anyone else has submitted it first though.
You shouldn't be using the History or the Back button in ASP.NET web applications. As a developer it is your job to create the navigation experience using .NET controls like - buttons, .NET hyperlinks, etc.
There is lots of code on the forums and knowledge base on how to export a report to PDF. The methods you want to look at are Export() and ExportToHttp(). You could easily call these from a Click event on a button you add to a web form. Stay away from just using JavaScript if you can.
The CrystalReportViewer control isn't solely based on JavaScript. It is a .NET control we created to allow you to view Crystal Reports in a web browser. Like all .NET controls it is comprised of .NET components plus JavaScript embedded in the HTML source page.
If you want to use the CrystalReportViewer you need to use the properties and methods exposed via the SDK. We never designed the control to be accessed directly with JavaScript.
Please read the documentation on how to use the viewer if you have any further questions.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.