gridLedgerReport.AllowPaging = false; gridLedgerReport.DataSourceID = string.Empty; gridLedgerReport.DataSource = ViewState["grid"]; gridLedgerReport.DataBind(); Response.Clear(); Response.Buffer = true; Response.ClearContent(); Response.ClearHeaders(); Response.Charset = ""; string fileName = "LedgerReportOn" + System.DateTime.Now.ToString("MM/dd/yyyy") + ".doc"; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/msword"; Response.AddHeader("Content-Disposition", "attachment;filename="+fileName ); gridLedgerReport.GridLines = GridLines.Both; gridLedgerReport.RenderControl(hw); Response.Write(sw.ToString()); Response.End();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)