0

I have a

<asp:Button runat="server" Text="Something" ID="btnFoo" OnClick="OnFoo" />

In the OnFoo event handler, I want to make a normal postback on the server (update database and rerender the UI) and at the same time I want to download a PDF file. There are problems when I send it like a Response (with headers, flushed etc.), because after it the page does not behave normally anymore.

So I thought myself (because I have never do that), that I could make a proxy button, where the javascript OnClick could click on both - the btnFoo and the <a href="download.aspx?p=123" target='_blank' />. (or window.open). In the download.aspx would be the file downloaded.

What do you think about it and what do you recommend, please?

theSpyCry
  • 12,073
  • 28
  • 96
  • 152
  • IMHO, opening another window tab is a messy. What problem do you face with writing the file to the response? – nunespascal Jul 17 '13 at 08:09
  • the page has to update the DB and re-render everything on the page inclusive new scripts from asp:ScriptManager. And the page does not work correctly if I write it to the response. – theSpyCry Jul 22 '13 at 08:26

0 Answers0