control datagrid1_.... must be placed inside a form tag with runat=server.
-
Respected Gurus I have to export a datagrid to excel in asp.net1.1 my code is:--- Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click Response.ContentType = "application/vnd.ms-excel" ' Remove the charset from the Content-Type header. Response.Charset = "" ' Turn off the view state. Me.EnableViewState = False 'Dim tw As New System.IO.StringWriter tw = New System.IO.StringWriter 'Dim hw As New System.Web.UI.HtmlTextWriter(tw) hw = New System.Web.UI.HtmlTextWriter(tw) ' Get the HTML for the control. DataGrid1.RenderControl(hw) ' Write the HTML back to the browser. Response.Write(tw.ToString()) ' End the response. Response.End() End Sub whenever i run this code i got the error message that control datagrid1_.... must be placed inside a form tag with runat=server. how to resolve it as all the controls are inside the form tag and runat=server attribute is also there. Plz suggest.
-
Respected Gurus I have to export a datagrid to excel in asp.net1.1 my code is:--- Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click Response.ContentType = "application/vnd.ms-excel" ' Remove the charset from the Content-Type header. Response.Charset = "" ' Turn off the view state. Me.EnableViewState = False 'Dim tw As New System.IO.StringWriter tw = New System.IO.StringWriter 'Dim hw As New System.Web.UI.HtmlTextWriter(tw) hw = New System.Web.UI.HtmlTextWriter(tw) ' Get the HTML for the control. DataGrid1.RenderControl(hw) ' Write the HTML back to the browser. Response.Write(tw.ToString()) ' End the response. Response.End() End Sub whenever i run this code i got the error message that control datagrid1_.... must be placed inside a form tag with runat=server. how to resolve it as all the controls are inside the form tag and runat=server attribute is also there. Plz suggest.