TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
AMOL
NA
17
13.9k
I want to save the contents of gridview to the excel file and i am using the following code to done ...
Aug 27 2012 12:55 AM
protected void SaveBtn_Click(object sender, EventArgs e)
{
try
{
System.IO.StringWriter sw = new System.IO.StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
Response.AddHeader("content-disposition", "attachment; filename=" + DropDownList1.SelectedItem.Text + "_" + DropDownList2.SelectedItem.Text + "_" + DropDownList3.SelectedItem.Text + "_" + TextBox1.Text + ".xls");
Response.ClearContent();
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.Flush();
Response.End();
}
catch (Exception ex)
{
}
}
public override void VerifyRenderingInServerForm(Control control)
{
/* Verifies that the control is rendered */
}
Reply
Answers (
1
)
datagrid checkbox
How can i implement a functionality (affliated ads)in asp.net website?