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
faraz akram
NA
129
0
exporting datagrid to pdf
Dec 6 2010 11:27 AM
hi am trying to export datagrid to pdf file by using this piece of code:
string
attachment =
"attachment; filename=Contacts.pdf"
;
Response.ClearContent();
Response.AddHeader(
"content-disposition"
, attachment);
Response.ContentType =
"application/pdf"
;
StringWriter
sw =
new
StringWriter
();
HtmlTextWriter
htw =
new
HtmlTextWriter
(sw);
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
the file save at disk very fine but when i open the file it give me the error as the file cannot be opened either it is damaged or some file sent via email..
plz advise
thanks in advance
Reply
Answers (
5
)
sending fax from windows application +C#
GridView PagerTemplate - How do I add text?