Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition","attachment;filename=GridViewExport.doc"); Response.Charset = ""; Response.ContentType = "application/vnd.ms-word "; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); GridView1.AllowPaging = false; GridView1.DataBind(); GridView1.RenderControl(hw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End();
<form runat="Server"> . . //gridview code . . </form>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)