In my code behind (c#) I dynamically created some RadioButtonLists with more RadioButtons in each of them. I put all controls to a specific Panel. What I need to know is how to access those controls later as they are not created in .aspx file (with drag and drop from toolbox)?
I tried this:
foreach (Control child in panel.Controls)
{
Response.Write("test1");
if (child.GetType().ToString().Equals("System.Web.UI.WebControls.RadioButtonList"))
{
RadioButtonList r = (RadioButtonList)child;
Response.Write("test2");
}
}
"test1" and "test2" dont show up in my page. That means something is wrong with this logic. Any suggestions what could I do?
See Question&Answers more detail:os