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

  • Home
  • SEARCH
  • 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

Right now I wrote download code in Masterpage code behind for Menu item click.
i wrote a .json file and want to download it with AFNetworking. But AFNetworking
I wrote a code to download an image from internet. And i have to
I wrote a method which exports values to excel file from an IEnumerable parameter.
I wrote some code to download some files from URLs, which I put in
I wrote a Java program to download a HTML page. But CPU usage is
Internet explorer used to prompt a user to download an excel file after doing
There's this Excel file I want users to be able to download from my
I wrote some code to download a URL to my disk, using an NSURLRequest
I want my web application users to download some data as an Excel file.

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.