using table1 as a template; table2 "deletes" the controls from table 1 when added

D

Daves

I have a asp:Table (with visible="false") which I use as a "template" for tr
& td data it contains to copy the layout to another Table which contains
multiple rows and is visible. When I have created a TableRow instance from
the template table and add it to the main table, the TableRow items are
removed from the template table so that I cannot use it next time the loop
iterates?!

while (_sqlDataReader.Read())
{
TableRow _tableRow = TableItems.Rows[0];

... code which fills in custom values to the TableRow controls ...
TableMain.Rows.Add(_tableRow);
}

In VS debugger I see that in the bottommost 2 lines the TableMain.Rows.Count
decreases from 1 to 0! What am I doing wrong?? I thought I was working with
a copy of the row template?!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top