Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
565
Export to Excel fails using AJAX
posted

I'm been playing with the Export to Excel tool on a page (on 2.0 framework) that is using AJAX, using the Infragistics example in the documentation as a guideline.

 The export fails with the following message:

"Server cannot set content type after HTTP headers have been sent"

The Excel file is never created.

 Is this tool usable with AJAX, or should I just scrap the whole thing.

 Thx.

Parents
  • 45049
    posted

    You likely need to trigger a normal postback with whatever control (likely a button) that you're using to cause the export.  By default, WebGridExcelExporter sends the exported Excel document as the response.  The UpdatePanel in the Microsoft's ASP.NET AJAX Extensions Toolkit expects the response to be in a certain XML format, and an Excel file fails to match that format.

    The WebAsyncRefreshPanel in NetAdvantage for .NET behaves in a similar fashion, though it doesn't display any exceptions.

    In either case, performing a normal postback won't affect what's displayed on your webpage.  Since the Excel file is sent to the browser as the response, as opposed to HTML data, the page won't be refreshed.  You'll still have the page the way you left it.

    Please remember that these forums area a peer-to-peer resource to share issues and ideas with other Infragistics users.  If you require official support from Infragistics, please submit a support request to Infragistics Developer Support from this page of our website.

Reply Children
No Data