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
1020
export
posted

I want show a wait icon when Export grid data to excel. My code is:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" >
<ContentTemplate> 
<span class="anniu">

<asp:Button ID="Button2" runat="server" Text="Export" OnClick="btnExcel_Click" />
</span>
</ContentTemplate>
<Triggers>

<asp:AsyncPostBackTrigger ControlID="Button2" EventName="Click" />

</Triggers>
</asp:UpdatePanel>

<asp:UpdateProgress ID="UpdateProgress1" runat="server" 
AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<img src="../../../images/ajax-loader.gif" style="width: 16px; height: 16px" />
</ProgressTemplate>
</asp:UpdateProgress>

I get a exception when I click button to export grid data.

If I change "asp:AsyncPostBackTrigge" to "asp:PostBackTrigge" ,It is ok but the image do not show.

How can I show the image when export ?

  • 29417
    Verified Answer
    Offline posted

     Hello foxbabby

    Thank you for posting in our forum.

    You cannot receive the created excel file during an ajax request. This is a limitation of the ajax itself.  It will throw an “Sys.WebForms.PageRequestManagerParserErrorException” due to the HttpRequest object inability to handle file streaming. A possible way to work around this is to create the file and save it in session, wait until the request is finished and trigger an action to retrieve the file and add it to the response header so that the user can download the file. 

    A sample to which you can refer to with this possible implementation is available here:http://ko.infragistics.com/community/forums/t/55904.aspx 

    Let me know if you have any questions. 

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support