Data Browser - Viewing Site  Sector 23 Code Bank Logged in as:  Guest  


Set GroupName for RadioButtons in repeater .NET
In a repeater, even if radio buttons have the same group name, they will not be linked in .NET. You will be able to click one in each row so they are all checked.

To resolve, first register this function on 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 (elm.disabled == false && re.test(
      elm.checked = false;
current.checked = true;

Then, add an onclick listener to your radiobutton, passing your GroupName.
onclick="SetUniqueRadioButton('myGroupNameHere', this)"

Created By: amos 12/3/2014 1:16:02 PM
Updated: 12/3/2014 1:17:46 PM