protected void btnExcelGenerator_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=FileName.xls"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); GridViewRefurb.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.Flush(); HttpContext.Current.ApplicationInstance.CompleteRequest(); }
GridView1.Columns[14].Visible = false; GridView1.Columns[15].Visible = false; GridView1.Columns[16].Visible = false;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)