An Ajax Toolbar for ASP.NET Crystal Reports

I blogged yesterday here, regarding fetching the total Number Of Pages in an ASP.NET web-based Crystal Report in the code-behind. My original motive for doing that was replacing the default Crystal Toolbar with a custom one. And continuing from that Blog post, I present here a custom Toolbar for ASP.NET Crystal Reports, which support the complete functionality of the default Crystal Report toolbar, but performs all its actions asynchronously (using Ajax), thus preventing any page refreshes and flickers.

I use Ext.Net/ExtJs for the ajax functionality. Basically the report is loaded in an inline iframe. The default Crystal Report toolbar is switched off, and instead a custom toolbar provides all the desired options. Any action like a request for Zoom, Page Change etc. is handled by loading the report again in the iframe using an async request.

The entire code for the Toolbar together with a Demonstration page is attached below.

Here are some screenshots for this toolbar:

Screenshot 1  Screenshot 2  Screenshot 3  Screenshot 4  Screenshot 5

AttachmentSize
Package icon AjaxedCR1.zip4.46 MB

Comments

Excelent, i was looking for this a lot. Thanks man.!!!!

rahul's picture

Keep hooked on, I plan to present a complete Ajax solution to CR report generation!!

Hello Rahul,

Excelent job, i was looking for this a lot.  I have created out custom crystal report control to show report.  All thing is working fine.  But when I add it in IIS (Windows 7 (IIS7)) and when I open report and click on print, It l hang.  I increase AjaxToolkit Postback time out from 60 to 3600.  but it not work at. I am using CType(Session(_ReportSource), CrystalDecisions.CrystalReports.Engine.ReportClass).PrintToPrinter(1, False, 1, 1).

The above code is work fine in VS 2008 ID.  but it not work in iis.

Your above code is work fine when I add it in iis.  

Please give me idea how to it work.  and what is you doing in it ?

Please reply as soon as possible.

Thanks & Regards,

Rupen

rahul's picture

Hi Rupen, the code is there for you to see what is happening in it. Try downloading the code, and compring it to your version to figure out where the problem lies. You might also want to start with the above code as reference and incrementally change it to achieve your version.

That is very well done. I ended up writing a cut down toolbar but leaving the Crystal toolbar visible!

Hi . This is very good job

but , How can I use this component for my project?

could you be nice please , to give an instruction for this?

Thank you

rahul's picture

Hi meysam, its upto you to figure out how to use this :) The attached zip contains a sample VS WSP project if I recall correctly and you can take it further anyway you like.

Excelent.

I know it's a little late, but you made the version 2.0

Thank you.

rahul's picture

Hi there, I was unable to understand what you meant by "made the version 2.0".

Thank you for reply.

I have the version 2.1 of ext.net and I have several errors.

Sorry for my English.

 

 

Hi

I have tried to execute your code from VS 2010. But it gives following javascript error at run time.

"Microsoft JScript runtime error: Object doesn't support property or method 'createContextualFragment'"

Can you help me to resolve this?

rahul's picture

Hi Sam, we are running this code both from VS 2008 as well as 2010 without an issue. I am running too short on time to try to reproduce. Please see if this error is generated in Crystal Reports javascript or ExtJs' javascript and try to see if you can resolve it.

I am just trying to run Defualt.aspx from vs 2010 and the error is generated from Ext JS Library. Any idea on how to resolve this?

rahul's picture

Hi sam, I am running a bit tight and unfortunately won't be able to test myself in the upcoming days, apologies!!

I don't recall exactly, can you please check if the code is using ExtJs from local disk or from some external CDN? Can you please post here urls for Ext scripts from the page's rendered source?

Even thought rendered file size is 8 kb I cannot attach it. Ext scripts seem to load from local disk.

rahul's picture

Hi sam, as I said I am running a bit tight. Let's see if I can help you debug over a remote session over the weekend. Can we take this offline, please send me an email at rs at rahulsingla.com with your timezone, and lets see if we can work together at a mutually convenient time.