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
Danish Habib
NA
694
243.5k
problem when exporting gridview content into excel
Jun 8 2015 3:04 AM
I have a Master page and a child page in child page i have a gridview showing the record set i want to export and print this records so i am using that code on button click event ...
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition",
"attachment;filename=GridViewExport.doc")
Response.Charset = ""
Response.ContentType = "application/vnd.ms-word "
Dim sw As New StringWriter()
Dim hw As New HtmlTextWriter(sw)
grdUserReports.AllowPaging = False
grdUserReports.DataBind()
grdUserReports.RenderControl(hw)
Response.Output.Write(sw.ToString())
Response.Flush()
Response.End()
The highlited row gives error that
"Control 'ctl00_ContentPlaceHolder1_grdUserReports' of type 'GridView' must be placed inside a form tag with runat=server."
Reply
Answers (
18
)
Puzzle Game in WebApplication with c#
How to call port number including in C# code when run on IIS