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. Datagrid in Tablecell

Datagrid in Tablecell

Scheduled Pinned Locked Moved ASP.NET
helptutoriallearning
4 Posts 3 Posters 1 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    I would like to insert a Datagrid in a Tablecell within the code, but i dont know really how to do. I need the table only for layout purpose, and the datagrid´s are produced in code on demand, but i dont know really how to do this. 1000 thanks in advanced to the more experienced user who is also helping a beginner with a rather simple problem.

    R M 2 Replies Last reply
    0
    • A Anonymous

      I would like to insert a Datagrid in a Tablecell within the code, but i dont know really how to do. I need the table only for layout purpose, and the datagrid´s are produced in code on demand, but i dont know really how to do this. 1000 thanks in advanced to the more experienced user who is also helping a beginner with a rather simple problem.

      R Offline
      R Offline
      Ranjith I
      wrote on last edited by
      #2

      Why dont you use Panel, instead of table cell if you want to use it for only display purpose. In code behing you can add your grid to the panel as panel1.Controls.Add(mygrid); VB,ASP, C#, ASP.NET, VB.NET, Oracle, SQL Server. -------------------------------------------------- Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." - Albert Einstein (1879-1955) "C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg." - Bjarne Stroustrup

      1 Reply Last reply
      0
      • A Anonymous

        I would like to insert a Datagrid in a Tablecell within the code, but i dont know really how to do. I need the table only for layout purpose, and the datagrid´s are produced in code on demand, but i dont know really how to do this. 1000 thanks in advanced to the more experienced user who is also helping a beginner with a rather simple problem.

        M Offline
        M Offline
        Mariusz Wojcik
        wrote on last edited by
        #3

        You have to add your control to the cell's Controls collection. If you're using HTML table (not the asp:Table) you have to:
        1. in the table cell set the ID and runat properties:

        2. in the code, add objects declaration (C#):

        protected protected System.Web.UI.HtmlControls.HtmlTableCell cell1;

        or if you're using ASP:Table object, just add objects declaration (C#):

        protected System.Web.UI.WebControls.TableCell aCell;

        And now, to add the DataGrid:

        DataGrid dg = new DataGrid();
        ...
        aCell.Controls.Add(dg);

        -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

        A 1 Reply Last reply
        0
        • M Mariusz Wojcik

          You have to add your control to the cell's Controls collection. If you're using HTML table (not the asp:Table) you have to:
          1. in the table cell set the ID and runat properties:

          2. in the code, add objects declaration (C#):

          protected protected System.Web.UI.HtmlControls.HtmlTableCell cell1;

          or if you're using ASP:Table object, just add objects declaration (C#):

          protected System.Web.UI.WebControls.TableCell aCell;

          And now, to add the DataGrid:

          DataGrid dg = new DataGrid();
          ...
          aCell.Controls.Add(dg);

          -- Mariusz 'mAv' Wójcik master e-software engineer (BPC)

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          1000000000 Thanks, the aCell.Controls.Add Method is the key!!!!!! Thanks a lot again!!! regards from innsbruck helli

          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