Reputation: 8421
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 suggest 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 on how exactly i can implement this or if you can think of something better.
Please do let me know if the question is not clear enough.
Upvotes: 3
Views: 369
Reputation: 2842
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.
Upvotes: 1
Reputation: 6022
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.
Upvotes: 1