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!

Nested Table, TableRow and TableCell

Status
Not open for further replies.

euntair

Programmer
Sep 13, 2007
53
US
I am having a problem with a nested TableCell object putting all of the data in the last page when it should be distributing it. Is there something I have to do beyond creating a new instance?
i.e. TableRow page = new TableRow()

int page_id = 1;
int row_id = 1;

TableCell pagecell = new TableCell();
Table pagetable = new Table();

Table control = new Table();

while ( foo.Read( )) {
TableCell accountcell = new TableCell();
TableRow accountrow = new TableRow();

accountrow.Controls.Add(accountcell );
pagetable.Controls.Add(accountrow );

if (row_id > 9 || (page_id == 1 && row_id == 1)) {

pagecell = new TableCell();
pagecell.Controls.Add(pagetable );

TableRow page = new TableRow();
page.Controls.Add(pagecell );

control.Controls.Add(page );

if (row_id > 9) {
row_id = 1;
++page_id;
}
} else {
pagecell.Controls.Add(pagetable );
}
++row_id;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top