table lost on postback
<p>I'm working on a web based quiz system.</p>

<p>I have code that generates an ASP.NET table with a list of questions and radiobutton lists that indicate the answers for the quiz questions.</p>

<pre><code>//Retrieve questions and answers - build the actual quiz
        DataTable dtQuiz = qr.GetQuizQuestions(QuizID);

        if (dtQuiz != null &amp;&amp; dtQuiz.Rows.Count &gt;= 1)
        {
            foreach (DataRow row in dtQuiz.Rows)
            {
                TableRow tr = new TableRow();
                TableCell tcQuestionNum = new TableCell();
                TableCell tcQuestion = new TableCell();

                tcQuestionNum.VerticalAlign = VerticalAlign.Top;

                tcQuestionNum.Controls.Add(new LiteralControl(row["QuestionNum"].ToString()));
                tcQuestion.Controls.Add(new LiteralControl(row["Question"].ToString()));

                RadioButtonList rblAnswers = qr.GetAnswers(QuizID, Int32.Parse(row["QuestionNum"].ToString()));
                tcQuestion.Controls.Add(rblAnswers);

                tr.Cells.Add(tcQuestionNum);
                tr.Cells.Add(tcQuestion);

                tblQuiz.Rows.Add(tr);
                tblQuiz.DataBind();
            }
        }
</code></pre>

<p>This code generates the content just fine - the quiz questions appear, and the radiobutton lists render as expected.</p>

<p>There's something weird when I have a separate button click event. After the user selects their answers, I want to do a postback and loop through the rows in the table, pulling the answers from the radiobutton list in the second cell of each row. I started down this path:</p>

<pre><code>        foreach (TableRow tr in tblQuiz.Rows)
    {
        TableCell tc = tr.Cells[1];
        RadioButtonList rbl = (RadioButtonList) tc.Controls[1];
    }
</code></pre>

<p>The problem is when the second button is clicked (to post the answers), the table has no rows. Why is this, and how can I correct this?</p>
