Retrieving values from dynamically created RadioButtonList
<p>My code-behind (c#) file declares RadioButtonLists dynamically for any given number of questions in my database using a while() loop:</p>

<p>I add items to each tmpRBL in a for loop.</p>

<p>I register each RadioButtonList to a child panel which I create at the beginning of each iteration of the while() loop.</p>

<p>I then add each panel to the parent panel.</p>

<pre><code>while(reader.Read()
{ 
    ...

    RadioButtonList tmpRBL = new RadioButtonList();
    temp = "RadioButtonList" + count.ToString();
    tmpRBL.ID = temp;
    tmpRBL.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Vertical;
    tmpRBL.TextAlign = System.Web.UI.WebControls.TextAlign.Left;

    ...

    for (int i = 1; i &lt;= numAnswers; i++)
    {
        tmpItem = new ListItem("", i.ToString());
        tmpRBL.Items.Add(tmpItem);
    }

    ...

    p.Controls.Add(tmpRBL);

    ...

    questionPanel.Controls.Add(p);

}
</code></pre>

<p>How can I retrieve the selectedIndexes of these dynamically created RadioButtonLists? I've spent the better part of the day trying various fixes from other similar questions online, but have had no luck.</p>

<p>If I use 'Inspect Element' in Chrome, I am able to see the RadioButtonLists in their desired locations ostensibly with the ID I have assigned (RadioButtonList1, RadioButtonList2, etc), but I everything I try ends up with a null object. </p>

<p>I'm relatively new to C# and this is my first time dealing with dynamic controls, so big thanks in advance for any help offered.</p>
