Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
How to Export Gridview to Word Format
WhatsApp
Ashish Srivastava
May 11
2016
777
0
2
protected
void
btnExportWord_Click(
object
sender, EventArgs e)
{
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();
}
Export Gridview
Word Format
Up Next
How to Export Gridview to Word Format