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

Upendra Pratap ShahiPosted Jun 8, 2015, 7:23 AM
Saroj Kumar SahuPosted Jun 8, 2015, 7:21 AM
Saroj Kumar SahuPosted Jun 8, 2015, 7:12 AM
Danish HabibPosted Jun 8, 2015, 7:11 AM
Upendra Pratap ShahiPosted Jun 8, 2015, 7:07 AM
Danish HabibPosted Jun 8, 2015, 7:05 AM
Upendra Pratap ShahiPosted Jun 8, 2015, 7:00 AM
Danish HabibPosted Jun 8, 2015, 6:39 AM
Upendra Pratap ShahiPosted Jun 8, 2015, 5:06 AM
Saroj Kumar SahuPosted Jun 8, 2015, 5:04 AM
Danish HabibPosted Jun 8, 2015, 5:00 AM
Upendra Pratap ShahiPosted Jun 8, 2015, 4:52 AM
Danish HabibPosted Jun 8, 2015, 4:47 AM
Upendra Pratap ShahiPosted Jun 8, 2015, 3:35 AM
Saroj Kumar SahuPosted Jun 8, 2015, 3:32 AM
Danish HabibPosted Jun 8, 2015, 3:27 AM
Upendra Pratap ShahiPosted Jun 8, 2015, 3:27 AM
Saroj Kumar SahuPosted Jun 8, 2015, 3:22 AM
Public Overloads Overrides Sub VerifyRenderingInServerForm (
ByVal control As Control)
'Verifies that the control is rendered
End Sub