Panel not displaying while dowloading file

Posted by James123 on Stack Overflow See other posts from Stack Overflow or by James123
Published on 2010-05-13T03:34:23Z Indexed on 2010/05/13 3:44 UTC
Read the original article Hit count: 287

Filed under:
|
|

I wrote download excel file in my code. If I click download button I need show ajax-load image (pnlPopup panel). But it is not displaying. I think because of Some "Response" statements (see below code). Download working fine, but simultaniously I want show loader panel too.

 <asp:Panel ID="pnlPopup" runat="server" visible="false">
    <div align="center" style="margin-top: 13px;">
       <asp:Image runat ="server" ID="imgDownload" src="Images/ajax-loader.gif" alt="" /> <br />
         <span class="updateProgressMessage">downloading ...</span>
    </div>

Protected Sub btnDownload_Click(ByVal sender As Object, ByVal e As EventArgs) 'Handles btnDownload.Click'
     Try

        pnlPopup.Visible = True
        Dim mSurvey As New Survey
        Dim mUser As New User
        Dim dtExcel As DataTable
        mUser = CType(Session("user"), User)
        dtExcel = mSurvey.CreateExcelWorkbook(mUser.UserID, mUser.Client.ID)
        Dim filename As String = "Download.xls"

        InitializeWorkbook()
        GenerateData(dtExcel)
        Response.ContentType = "application/vnd.ms-excel"
        Response.AddHeader("Content-Disposition", String.Format("attachment;filename={0}", filename))
        Response.Clear()
        Response.BinaryWrite(WriteToStream.GetBuffer)
        Response.End()

    Catch ex As Exception

    Finally
    End Try


End Sub

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about vb.net