Hi,
I need to change the mouse pointer to hourglass before the excel export starts and change it back to default after it is done. I am changing the cursor to hourglass when I click on the image button that starts the export. However, I can't get back to the page I was on to change the mouse pointer back to default. Looks like the control is lost for that page. I tried to do it inside the EndExport event which I thought would be my last chance to change the mouse pointer back to normal, however the javascript I ran from the event method had no effect at all. So effectively when I come back to the page, the cursor is still hourglass. Is there a way to get control back to the page so that either the page can be refreshed or mouse pointer can be changed? The reason I need to do it because the databinding and actual export is taking much longer due to size of the data. Thanks a bunch.
You'll probably want one MemoryStream, it can contain a Workbook having multiple Worksheets. The following knowledge base article describes one way of switching between Worksheets for each call to the Export method to achieve this effect (note that since 2004 when this article was written, the ActiveWorksheet property has been deprecated so it won't show up in IntelliSense).
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=6146
Thanks for the reply. I am trying to use an iframe to display the excel sheet. I exported to a memorystream first instead of exporting directly to excel and trying to use Response.BinaryWrite to export to excel using the excel content type. It is working ok, my only problem is how to export to multiple excel sheets. I have multiple memorystreams for each sheet data. Or should I have only one memorystream for all the data. But again not sure how to distribute it to multiple sheets. Any help would be appreciated. Thanks. Rajiv.
HTTP has a request-response message exchange pattern, meaning each HTTP request from the browser can have only one HTTP response from the server.
So when you postback to do an Export, the HTTP response from the server is going to be the binary Excel (.XLS) file. If in addition to the Export, you make any other changes that you expect to affect the HTML or Javascript on the page such as for example changing the mouse pointer style, during this same request, they won't have any effect (because the response was only an Excel file, no HTML).
One approach I have seen used in situations where the client can't digest a binary XLS file or doing so throws things out of whack (you know, you're an AJAX UpdatePanel and you only speak JSON and then this binary Excel file hits you and you have no idea how to deal with it), is to trigger the export from within a hidden (or not so hidden) iframe. That way the Excel file hits the iframe and not the rest of the page. This is still good enough to convince the browser to do what it's supposed to do, prompt the user to open or save the Excel file. It may allow you to kick-off a second HTTP request that updates the HTML or Javascript on the page and changes the cursor CSS style back to what you want.
See what pgrimes629 did for an example of this approach (it's not a clean fit to your problem but it shows one way to set-up the iframe, and using a modal window may be an alternative):https://es.infragistics.com/community/forums/f/ultimate-ui-for-wpf/46798/auto-generate-fields-just-for-an-interface#46798.
You'll still have a challenge figuring out when the Excel file has finished downloading, to deactivate the hourglass cursor, since the two HTTP requests will be asynchronous (and the one to get the updated mouse cursor will probably be much faster than the Excel export). Hopefully my explanation can help you hone in on where the trouble lies.