I have the following Code:
foreach (MyClass d in myClassCollecti on)
{
curRadioBtn = new RadioButton();
curRadioBtn.Tex t = d.ToString();
curRadioBtn.Gro upName = "Contact";
curRadioBtn.ID = d.Name;
curRadioBtn.Ena bleViewState = true;
curRadioBtn.Che ckedChanged += RadioButton_Che ckedChanged;
curPanel = new Panel();
curPanel.Height = curRadioBtn.Hei ght;
curPanel.Contro ls.Add(curRadio Btn);
panel1.Controls .Add(curPanel);
}
and I have two other RadioButtons on the form already, they are on Panel1.
The ones on the form cause RadioButton_Che ckedChanged to be fired on a post
back, but the dynamiclly created ones don't.
The questions I have are:
1) How do I cause the dynamic radio buttons to fire the event?
2) How do I tell which one is selected, out side of firing the event?
I know I can get the ID in the event from the sender, just curious
on how to do it without the event.
3) When I do the post back all the dynamicly created RadioButtons go away,
how do I force the page to remember them when it's redisplayed without
having to re-create them?
Thanks
Wayne Sepega