By default, you cannot group radiobutton controls within a repeater as the repeater mangles the names. I had this exact problem when changing from checkboxes to radio buttons – after searching Google for 10 mins, I found a post at the following site by Eric Smith which i’ll copy the relevant info here so I don’t lose it
http://www.codeguru.com/csharp/csharp/cs_controls/custom/article.php/c12371/
Add the following Javascript code to your page:
function SetUniqueRadioButton(nameregex, current) { re = new RegExp(nameregex); for(i = 0; i < document.forms[0].elements.length; i++) { elm = document.forms[0].elements[i] if (elm.type == 'radio') { if (re.test(elm.name)) { elm.checked = false; } } } current.checked = true; }
Now for the repeater itself,
protected void rptPortfolios_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) return; RadioButton rdo = (RadioButton)e.Item.FindControl("rdoSelected"); string script = "SetUniqueRadioButton('rptPortfolios.*Portfolios',this)"; rdo.Attributes.Add("onclick", script); }