Response.AddHeader("content-disposition", "attachment;filename=Stockout_" + lblprevmnthname.Text + @"_" + lblyear.Text + ".xls"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); GridView1.RenderControl(hw); string folderYear = lblyear.Text; string folderMonth = lblprevmnthname.Text; string serverDirectory = Server.MapPath("~/Monthly/" + folderYear + @"/" + folderMonth + @"/warehouse/" + "Stockout_" + lblprevmnthname.Text + @"_" + lblyear.Text + ".xls"); var pathwarehouse = Server.MapPath(serverDirectory); File.WriteAllText(pathwarehouse, sw.ToString()); GridView1.AllowPaging = false; GridView1.DataBind();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)