Response.ContentType = "application/vnd.ms-excel"; string FileName = "PoliciesDetailsForBranch"; Response.AppendHeader("content-disposition", "attachment; filename=" + FileName + ".xls"); GridView gv = new GridView(); this.EnableViewState = false; gv.DataSource = (DataTable)dt; gv.DataBind(); this.ClearControls(gv); System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(Response.Output); gv.RenderControl(hw); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)