try { System.Web.UI.WebControls.Repeater gvSource = (System.Web.UI.WebControls.Repeater)Source; string attachment = "attachment; filename=" + strFileName.Trim().ToUpper() + ".xls"; HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.AddHeader("content-disposition", attachment); HttpContext.Current.Response.ContentType = "application/ms-excel"; System.IO.StringWriter sw = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw); // htw.WriteLine("<H1>" + lblHeader.Text.ToString() + ddlAccounts.Text.ToString()+ "<H1>"); gvSource.RenderControl(htw); HttpContext.Current.Response.Write(sw.ToString()); HttpContext.Current.Response.End(); } catch (Exception Ex) { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)