views:

39

answers:

2

Hi All

I have a aspx page in which i create reports and charts on the fly. Creation of these charts and reports takes a lot of time because of which a blank screen is shown to the user until the creation completes.

Can you guys sugest ways by which i can unlink actual report and chart creation code from page load so that i can show a processing text and then show the generated chart or report once it is ready.

EDIT :- I would want to do something like this - on first request trigger the report or chart creation and register a call back for completion. the client can then poll the server every 2-3 seconds to check if the report creaetion is complete. I need help from you guys on how exactly i can implement this or if you guys can think of something better.

Please do let me know if the question is not clear enough.

+1  A: 

It doesn't matter whether your code is in Page_Load or in any other event that fires during the page life cycle. You probably want an Ajax type approach for your charting. I don't know exactly what you're doing, but I've used SSRS ReportViewer control with great success.

e36M3
how exactly does your report viewer control solve this problem. I donot have a report ready to be viewed, i need to create them as when requested for
Vinay B R
Because the ReportViewer control is asynchronous in relation to the page. In essence the client will get the page back from the server while the report will still be generated. In essence it's not much different than what is being suggested by o6tech, using an UpdatePanel. It just depends on what type of reporting your working with.
e36M3
+1  A: 

A quick solution is to move the logic out of Page_Load and into it's own function. Add an <asp:UpdatePanel> to where you want the chart to be displayed and add an <asp:Timer> control to your page. For the timer's On_Tick event, call the code that generates and displays the chart, disable the timer (so it doesn't tick again) and call Update() on your UpdatePanel.

This will cause the page to load with the basic output, then the timer will kick off an AJAX call to generate and display your charts. It's not the most elegant solutions, but it's probably the quickest to implement.

o6tech
@o6tech - this is a mjor functionality in my web app. I do not want a quick fix for it. I would like to sepnd time implementing the best possible solution so please feel free to sugest as many possible ways of doing this as possible. I am new to asp.net ajax so it will help if you add links to helpful sites which elaborate onyour idea.
Vinay B R
Well, there really is nothing "wrong" with this solution, but we can dig a little deeper. What's the nature of the report and charts? Are they specific to a user? How time-sensitive is the data? Depending on your answers, it may be best to implement some sort of caching and report/chart generation in an outside process.
o6tech