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."


Saroj Kumar SahuRank #1,766 · 849 reputationPosted Jun 7, 2015, 11:22 PM EDT
Public Overloads Overrides Sub VerifyRenderingInServerForm (
ByVal control As Control)
'Verifies that the control is rendered
End Sub
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 7, 2015, 11:27 PM EDT
Danish HabibRank #2,024 · 715 reputationPosted Jun 7, 2015, 11:27 PM EDT
Saroj Kumar SahuRank #1,766 · 849 reputationPosted Jun 7, 2015, 11:32 PM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 7, 2015, 11:35 PM EDT
Danish HabibRank #2,024 · 715 reputationPosted Jun 8, 2015, 12:47 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 8, 2015, 12:52 AM EDT
Danish HabibRank #2,024 · 715 reputationPosted Jun 8, 2015, 1:00 AM EDT
Saroj Kumar SahuRank #1,766 · 849 reputationPosted Jun 8, 2015, 1:04 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 8, 2015, 1:06 AM EDT
Danish HabibRank #2,024 · 715 reputationPosted Jun 8, 2015, 2:39 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 8, 2015, 3:00 AM EDT
Danish HabibRank #2,024 · 715 reputationPosted Jun 8, 2015, 3:05 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 8, 2015, 3:07 AM EDT
Danish HabibRank #2,024 · 715 reputationPosted Jun 8, 2015, 3:11 AM EDT
Saroj Kumar SahuRank #1,766 · 849 reputationPosted Jun 8, 2015, 3:12 AM EDT
Saroj Kumar SahuRank #1,766 · 849 reputationPosted Jun 8, 2015, 3:21 AM EDT
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Jun 8, 2015, 3:23 AM EDT