I'm trying to do something simple and have done this in the past but am having a bit of coders block. What I'm trying to do is on a button click dynamicaly add a RadPanelItem to a panel bar and populate it with a group of checkboxes. Every time I try to add a control to the underlying item it gets dumped on postback. A much simplified version of my code is below any help would definatly be appriciated. I'm trying to stay away from the Page_PreInit as I would like to put what I am working on in a usercontrol.
protected
void btnTEST_Click(object sender, EventArgs e)
{
for (int i = 0; i < 1; i++)
{
radpanelitem1.Items.Add(NewItem());
}
}
protected
RadPanelItem NewItem()
{
RadPanelItem o = new RadPanelItem("TEST PANEL");
CheckBox y = new CheckBox();
y.ID =
"TestCheckbox";
o.Controls.Add(y);
return o;
}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (RadPanelItem r in radpanelitem1.Items)
{
foreach (Control y in r.Controls)
{
if (y is CheckBox)
System.Diagnostics.
Debug.WriteLine((y as CheckBox).Checked.ToString());
}
}
}