Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding Column to a table

Status
Not open for further replies.
Jun 5, 2006
28
US
Hi,
I know you can add a row to a table by doing

Table table = new Table();
table.Rows.Add(new Row());

How would you go about adding a column to that table?

Thanks.
 
Just taking about a regular table.

Table table = new Table();
 
I think maybe you need to be in the ASP.net forum?

But here is a good place to start:


Hope this helps,

Alex

[small]----signature below----[/small]
Who are you, and why should I care?
Side A: We're a community of outdated robots who refused to upgrade and came here
*changes sides*
Side B: to live a simpler existence. Free of technology.
 
Unfortunately, you can't just add a column.. Because a table structure is built as a ROW then CELL..

To add a column, you will need to itterate through the existing rows and then add a new column..


foreach (TableRow tr in t.Rows)
{
TableCell td = new TableCell();
tr.Cells.Add(td);
}


I hope this was helpful.

Cheers,

G.


Oxigen - Next generation business solutions
-----------------------------
Components/Tools/Forums/Software/Web Services
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top