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 3222312
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:58:35+00:00 2026-05-17T15:58:35+00:00

I am generating an Excel file upon a click of a button in an

  • 0

I am generating an Excel file upon a click of a button in an update panel. It is throwing a parsing error. Please see below code.

If I keep the button outside the update panel it is working fine. Why isn’t it working in the update Panel?

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("Content-Disposition", 
                    String.Format("attachment;filename={0}", filename))
Response.Clear()
Response.BinaryWrite(WriteToStream.GetBuffer)
HttpContext.Current.ApplicationInstance.CompleteRequest()

Private Function WriteToStream() As MemoryStream
    'Write the stream data of workbook to the root directory
    Dim file As MemoryStream = New MemoryStream
    hssfworkbook.Write(file)
    Return file
End Function
  • 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-17T15:58:36+00:00Added an answer on May 17, 2026 at 3:58 pm

    You shouldn’t be overwriting the response for an update panel. The way the ASP update panels work, the entire page executes, and the portion within the update panel is pulled from the response and sent to the client (as a response to an XHRequest). When you do a Response.BinaryWrite, you are obliterating the standard output that the server is expecting to be able to parse through for the new markup it wants to send.

    The only reason to have the button trigger the update panel is if you want to change the content within that panel. Otherwise, simply make sure the button is not a trigger of the panel. If the button must stay in the panel, add it to the panel’s trigger section as a PostBackTrigger (note the lack of Async on that).

    E.g.:

    <asp:UpdatePanel ID="somePanel" UpdateMode="Conditional" runat="server">
      </ContentTemplate>
        changing content?
        <asp:Button id="someButton" Text="click me!" 
                    OnClick="someButton_Click" runat="server">
        other changing content?
      </ContentTemplate>
      <Triggers>
        <asp:PostBackTrigger ControlID="someButton" />
      </Triggers>
    </asp:UpdatePanel>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am generating an Excel file through MATLAB and I have empty cells in
I have long HTTP request ( generating large Excel file - about 60K records
Generating normal columnar data in excel file is quite easy but does any one
I'm using the following code to generate an Excel file using Microsoft.Interop.Excel. The problem
Hello I am generating an excel file inside my action that I would return
Have a program that's dynamically generating an Excel file and a csv. The excel
I'm generating an Excel file in PHP using the PHPExcel library. I am placing
I need to design a small project for generating excel reports in .NET, which
Do you have any tricks for generating SQL statements, mainly INSERTs, in Excel for
I'm generating ICalendar (.ics) files. Using the UID and SEQUENCE fields I can update

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.