Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. control datagrid1_.... must be placed inside a form tag with runat=server.

control datagrid1_.... must be placed inside a form tag with runat=server.

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-netdesignsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MissionSuccess
    wrote on last edited by
    #1

    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.

    S 1 Reply Last reply
    0
    • M MissionSuccess

      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.

      S Offline
      S Offline
      sPaudel
      wrote on last edited by
      #2

      check it "http://www.codeproject.com/aspnet/DAtaGridExportToExcel.asp"

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups