Control 'ctl00_ContentPlaceHolder1_gv' of type 'GridView' must be placed inside a form tag with runat=server.
Z code
Response.Clear()
Response.AddHeader("Content-Disposition", "inline;filename=Backup.xls")
Response.Charset = "iso-8859-1,windows-1252"
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentEncoding = System.Text.Encoding.UTF7
Response.ContentType = "application/vnd.ms-excel"
Page.EnableViewState = False
Dim strwrite As New System.IO.StringWriter
Dim htmwrire As New System.Web.UI.HtmlTextWriter(strwrite)
'gv.Columns(0).Visible = "False"
GridView1.RenderControl(htmwrire)
Response.Write(strwrite.ToString())
Response.End()
Z Method to include on the page
Public Overrides Sub VerifyRenderingInServerForm(ByVal control As System.Web.UI.Control)
End Sub
Z code to be added in Page directive
<%@ Page EnableEventValidation="false" %>
I , Me , Myself
- Sachin
- Hi .. This is Sachin Uchil. I have been in the field of .NET development for about 2 years now. Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.