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

Discussion in 'ASP .Net Web Controls' started by Daves, Jan 17, 2006.

  1. Daves

    Daves Guest

    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?!
     
    Daves, Jan 17, 2006
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.