W
Wayne Sepega
I have the following Code:
foreach (MyClass d in myClassCollection)
{
curRadioBtn = new RadioButton();
curRadioBtn.Text = d.ToString();
curRadioBtn.GroupName = "Contact";
curRadioBtn.ID = d.Name;
curRadioBtn.EnableViewState = true;
curRadioBtn.CheckedChanged += RadioButton_CheckedChanged;
curPanel = new Panel();
curPanel.Height = curRadioBtn.Height;
curPanel.Controls.Add(curRadioBtn);
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_CheckedChanged 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
foreach (MyClass d in myClassCollection)
{
curRadioBtn = new RadioButton();
curRadioBtn.Text = d.ToString();
curRadioBtn.GroupName = "Contact";
curRadioBtn.ID = d.Name;
curRadioBtn.EnableViewState = true;
curRadioBtn.CheckedChanged += RadioButton_CheckedChanged;
curPanel = new Panel();
curPanel.Height = curRadioBtn.Height;
curPanel.Controls.Add(curRadioBtn);
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_CheckedChanged 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