Welcome on Kweetix Technical Blog

Monday, May 10, 2010

Fix the GroupName bug in FrameWork .NET with RadioButton in a repeater

Javascript method to add (From ASPX 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;
}

Event to add to the RadioButton (from Code Behind)

coregValue.Attributes["onclick"] = "SetUniqueRadioButton('repeaterID.*GroupName', this);";

No comments:

Post a Comment