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
Apurva Singh
NA
268
57.4k
export to excel
Jul 13 2018 5:34 AM
I have a gried view data.
on export to excel click it return only <div> </div>.
Here is my code.
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
string FileName = "StockinhandDetails" + DateTime.Now + ".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(
strwritter
);
here return data <div> </div>
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
smallbanner1.GridLines = GridLines.Both;
smallbanner1.HeaderStyle.Font.Bold = true;
smallbanner1.RenderControl(htmltextwrtter);
Response.Write(strwritter.ToString());
Response.End();
Please help.
Reply
Answers (
2
)
c# N-Way Set associative
c# coding in webform