for an Asp.Net ListView:
foreach(ListViewDataItem myItem in myListView.Items)
{
RadioButton btn1 = (RadioButton)myItem.FindControl("radiobutton1");
RadioButton btn2 = (RadioButton)myItem.FindControl("radiobutton2");
RadioButton btn3 = (RadioButton)myItem.FindControl("radiobutton3");
bool AtLeastOneChecked = btn1.Checked || btn2.Checked || btn3.Checked;
}
New approach - not knowing the # of radio buttons
foreach(ListViewDataItem myItem in myListView.Items)
{
bool AtLeastOneChecked = false;
foreach(Control myControl in myItem.Controls)
{
try
{
RadioButton rdoTemp = (RadioButton)myControl;
AtLeastOneChecked = rdoTemp.Checked;
}
catch (Exception)
{
// do nothing - this probably wasn't a radio button control and errored out onthe conversion
}
}
}