Deleting all rows from a dynamically created table
<p>I have a page where I am dynamically creating an asp.net table.  At some point based on user input I need to be able to delete all the rows in the table and recreate them from scratch.  When I try to loop through the table rows and remove them one by one I get the following error.  "Collection was modified; enumeration operation may not execute.  "</p>

<p>Is there another way to do this?  This code is the first thing in the function that creates the dynamic rows.</p>

<pre><code>foreach (TableRow tr in ChecklistQuestionTable.Rows)
        {
            ChecklistQuestionTable.Rows.Remove(tr);
        }
</code></pre>
