Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. gridviw data export to excel and save as zip format?? urgent!!!

gridviw data export to excel and save as zip format?? urgent!!!

Scheduled Pinned Locked Moved ASP.NET
tutorialquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    anujchetan
    wrote on last edited by
    #1

    hello, how to gridview data export to excel and it should save as zip file?? plz give me complete source code?? its urgent... chotachetan

    K Y 2 Replies Last reply
    0
    • A anujchetan

      hello, how to gridview data export to excel and it should save as zip file?? plz give me complete source code?? its urgent... chotachetan

      K Offline
      K Offline
      kishorgh
      wrote on last edited by
      #2

      Take one image..on clcik of tht right following code its save gridview data as .xls not in zip file protected void imgBtnExport_Click(object sender, ImageClickEventArgs e) { System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); try { DateTime dtFromDate, dtToDate; dtFromDate = Convert.ToDateTime(txtFromDate.Text); dtToDate = Convert.ToDateTime(txtToDate.Text); Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=ExcelName.xls"); Response.Charset = ""; // If you want the option to open the Excel file without saving then // comment out the line below Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; this.EnableViewState = false; GridView grdExp = new GridView(); grdExp.AllowPaging = false; grdExp.AllowSorting = false; DataSet dsRawProd = objReportBL.GetRawProductivityData(dtFromDate.ToShortDateString(), dtToDate.ToShortDateString(), 0, 0); if (dsRawProd.Tables.Count > 0 && dsRawProd.Tables[0].Rows.Count > 0) { DataTable dtRowPrd = dsRawProd.Tables[0]; DataView dv = new DataView(dtRowPrd); grdExp.DataSource = dv; grdExp.DataBind(); //grdExp.Columns. grdExp.RenderControl(htmlWrite); } } catch (Exception) { } Response.Write(stringWrite.ToString()); Response.End(); }

      A 1 Reply Last reply
      0
      • K kishorgh

        Take one image..on clcik of tht right following code its save gridview data as .xls not in zip file protected void imgBtnExport_Click(object sender, ImageClickEventArgs e) { System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite); try { DateTime dtFromDate, dtToDate; dtFromDate = Convert.ToDateTime(txtFromDate.Text); dtToDate = Convert.ToDateTime(txtToDate.Text); Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=ExcelName.xls"); Response.Charset = ""; // If you want the option to open the Excel file without saving then // comment out the line below Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; this.EnableViewState = false; GridView grdExp = new GridView(); grdExp.AllowPaging = false; grdExp.AllowSorting = false; DataSet dsRawProd = objReportBL.GetRawProductivityData(dtFromDate.ToShortDateString(), dtToDate.ToShortDateString(), 0, 0); if (dsRawProd.Tables.Count > 0 && dsRawProd.Tables[0].Rows.Count > 0) { DataTable dtRowPrd = dsRawProd.Tables[0]; DataView dv = new DataView(dtRowPrd); grdExp.DataSource = dv; grdExp.DataBind(); //grdExp.Columns. grdExp.RenderControl(htmlWrite); } } catch (Exception) { } Response.Write(stringWrite.ToString()); Response.End(); }

        A Offline
        A Offline
        anujchetan
        wrote on last edited by
        #3

        But i want i should save as zip format... it should be save as zip format omly...

        1 Reply Last reply
        0
        • A anujchetan

          hello, how to gridview data export to excel and it should save as zip file?? plz give me complete source code?? its urgent... chotachetan

          Y Offline
          Y Offline
          Yusuf
          wrote on last edited by
          #4

          anujchetan wrote:

          plz give me complete source code??

          that would cost you One Lakh Crore

          Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups