You can use jQuery's
$=
to find elements where the attribute ends with the specified string:
function ValidateRadioButton1(sender, args) {
args.IsValid = $("input[name$='Game_1']:checked").length > 0;
}
Attribute Ends With Selector [name$=”value”] | jQuery API Documentation[
^]
NB: If you're using a data-bound control, things will be more complicated. You will probably need a wrapper element which contains the radio button pairs and the custom validator:
<ItemTemplate>
<div class="rb-wrapper">
<asp:RadioButton ID="radBears" runat="server" Text="Bears" GroupName="Game_1" CssClass="rnd" />
<asp:RadioButton ID="radRaiders" runat="server" Text="Raiders" GroupName="Game_1" CssClass="rnd" />
<asp:CustomValidator runat="server" ErrorMessage="Selection is required" ClientValidationFunction="ValidateRadioButtonList" />
</div>
</ItemTemplate>
You would then need to find the closest container to the validator, and look for a checked item within that container:
function ValidateRadioButtonList(sender, args) {
args.IsValid = $(sender).closest(".rb-wrapper").find("input:radio:checked").length > 0;
}