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