How to return two results with one postback

Discussion in '.NET' started by egyedg, Mar 11, 2009.

  1. egyedg

    egyedg

    Joined:
    Mar 11, 2009
    Messages:
    1
    Hi,

    Does anyone know if it is possible (and it it is, how) to return multiple download responses for one postback request in ASP.NET.

    The scenario is the following:
    The user pushes an Export button, after which, in the event handler function of the button an SqlDataReader fills up a TextWriter which overwrites the content of the page's HttpResult.
    Ex:
    Response.ContentType = "application/text";
    Response.ClearContent();
    Response.AddHeader("content-disposition", "attachment; filename=\"" + fileName + "\"");
    Response.Write(textWriter.ToString());
    Response.Flush();
    Response.Close();

    It works fine till this point.
    Now it is required to return two versions of this result with the same button click (only 1-2 extra lines and the filename would be different between the two responses).

    I was wondering if it is possible to achieve this using a single postback, because the running time of the SqlDataReader is pretty long (up to 30 sec), and I would like to avoid running it twice if it is possible.
    Also the size of the returned recordset can grow up, so i don't want to store it in a session variable.

    Thanks in advance.
     
    egyedg, Mar 11, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. news.frontiernet.net
    Replies:
    6
    Views:
    1,129
    news.frontiernet.net
    Apr 16, 2004
  2. GenxLogic
    Replies:
    3
    Views:
    1,289
    andrewmcdonagh
    Dec 6, 2006
  3. Greenhorn
    Replies:
    15
    Views:
    833
    Keith Thompson
    Mar 6, 2005
  4. lovecreatesbeauty
    Replies:
    8
    Views:
    1,665
    Old Wolf
    Sep 12, 2005
  5. kazaam
    Replies:
    3
    Views:
    82
    Daniel DeLorme
    Aug 29, 2007
Loading...

Share This Page