Datagrid to Excel

Discussion in 'ASP .Net' started by monalisa, Dec 9, 2005.

  1. monalisa

    monalisa Guest

    I have a Datagrid in ASP.NET , Witch contains employee info and a
    Dropdownlist and a calendar control.
    For performance issue, the user wanted to fill this form in Excel, so I need
    to export the Data to Excel file to be (offline), and create the drop down
    list dynamically into the excel.
    How I can do it , and if there is another suggestion of doing this
    (infoPath)
    monalisa, Dec 9, 2005
    #1
    1. Advertising

  2. Monalisa go through
    http://www.dotnetjohn.com/articles.aspx?articleid=78
    And for formatting tips
    look at:-
    http://weblogs.asp.net/datagridgirl/archive/2003/04/14/5631.aspx
    Patrick

    "monalisa" <> wrote in message
    news:emcue7J$...
    > I have a Datagrid in ASP.NET , Witch contains employee info and a
    > Dropdownlist and a calendar control.
    > For performance issue, the user wanted to fill this form in Excel, so I

    need
    > to export the Data to Excel file to be (offline), and create the drop down
    > list dynamically into the excel.
    > How I can do it , and if there is another suggestion of doing this
    > (infoPath)
    >
    >
    >
    Patrick.O.Ige, Dec 9, 2005
    #2
    1. Advertising

  3. monalisa

    Mark Rae Guest

    "Patrick.O.Ige" <> wrote in message
    news:e8mmtaK$...

    > Monalisa go through
    > http://www.dotnetjohn.com/articles.aspx?articleid=78


    This works really well, and there are loads of similar examples all over the
    Internet.

    I'm using the following code:

    Response.Clear();
    Response.ContentType = "application/vnd.ms-excel";
    Response.AddHeader("content-disposition",
    "attachment;filename=c:\\valuations.xls");
    Response.Charset = "";
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    this.EnableViewState = false;
    System.IO.StringWriter objSW = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter objHTMLTW = new HtmlTextWriter(objSW);
    tblResults.RenderControl(objHTMLTW);
    Response.Write(objSW.ToString());
    Response.End();

    That's fine, except that it displays the data in the same browser window.

    Is there an easy way to actually open up Excel itself rather than merely
    displaying the Excel data in the browser? Even opening up another browser
    window would be better...
    Mark Rae, Dec 9, 2005
    #3
    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. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Excel _WorkBook vs. Excel.Workbook

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Sep 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    3,631
    Steve C. Orr [MVP, MCSD]
    Sep 29, 2004
  2. Luis Esteban Valencia
    Replies:
    1
    Views:
    1,379
    Carl Prothman [MVP]
    Jan 12, 2005
  3. =?Utf-8?B?U3JpZGhhcg==?=

    using Microsoft Excel image for Export to Excel button

    =?Utf-8?B?U3JpZGhhcg==?=, Dec 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    3,095
    =?Utf-8?B?U3JpZGhhcg==?=
    Dec 9, 2005
  4. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Replies:
    15
    Views:
    1,494
    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=
    Oct 24, 2007
  5. Paul D. Fox

    Display a Datagrid & Export a Datagrid to Excel

    Paul D. Fox, Jul 21, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    215
    Elton Wang
    Jul 21, 2005
Loading...

Share This Page