Validation groups are intended to provide different sets of validation for different buttons. If you want all of the validators to fire when you click one button, then either don't set the validation groups, or set them all to the same value.
The validation summary is used to display a summary of all validation error on the form. It is not meant to display the validation errors for a single control. Use the validator control to do that.
<asp:CustomValidator runat="server" ForeColor="Red" Font-Bold="false" Display="Dynamic" Text="Please select one of the radio buttons" OnServerValidate="ValidateSample1" />
<asp:RadioButton ID="RadioBtn1" runat="server" ValidationGroup="sample1" GroupName="rpt1" Text="One" />
<asp:RadioButton ID="RadioBtn2" runat="server" ValidationGroup="sample1" GroupName="rpt1" Text="Two" />
<asp:CustomValidator runat="server" ForeColor="Red" Font-Bold="false" Display="Dynamic" Text="Please select one of the radio buttons" OnServerValidate="ValidateSample2" />
<asp:RadioButton ID="RadioBtn3" runat="server" ValidationGroup="sample2" GroupName="rpt2" Text="Three" />
<asp:RadioButton ID="RadioBtn4" runat="server" ValidationGroup="sample2" GroupName="rpt2" Text="Four" />
protected void ValidateSample1(object sender, ServerValidateEventArgs e)
{
args.IsValid = RadioBtn1.Checked || RadioBtn2.Checked;
}
protected void ValidateSample2(object sender, ServerValidateEventArgs e)
{
args.IsValid = RadioBtn3.Checked || RadioBtn4.Checked;
}
Now, do yourself a favour and give your controls meaningful IDs, rather than accepting the defaults provided by Visual Studio. You might remember what
RadioBtn42
means
now, but when you come back to your code in six months time, you'll be cursing the person who wrote it!