Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 780379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:03:47+00:00 2026-05-14T20:03:47+00:00

I wrote download excel file in my code. If I click download button I

  • 0

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
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:03:48+00:00Added an answer on May 14, 2026 at 8:03 pm

    Your approach of showing the element via server side code is not going to work. When your button is clicked, your page will post back and the Excel file will be written to the response stream, and the page the user is viewing will not change, because you are not sending HTML back to the browser.

    Instead, you can easily implement this by showing the image and text using Javascript. Simply have a div tag that is hidden (display: none; with CSS), and using the OnClientClick property of your button, write some Javascript to show the div tag.

    As an alternate to writing the Javascript yourself, you could also look into the ASP.NET Ajax controls for help implementing this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a method which exports values to excel file from an IEnumerable parameter.
I want to download a file from server to a local host. i have
I have a code to downolad a particular file that is stored at a
I am using the following code to export a data set to an Excel
I am using ASP.NET to transmit a .jar file. This code works perfectly on
I am trying to place an action to happen after an entire .aspx page
I have to create a script that takes a mySQL table, and exports it
I am using IBM Websphere Application Server v6 and Java 1.4 and am trying
Solved I actually found out what is going on here. Turns out it was

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.