After much trial and mostly error, I decided to find my own solution for validating if at least one checkbox was selected in a group of controls. I used C# code to determine if any one control was checked, followed by code to redirect the page to an anchor (i.e. <a name=â€checkbox_controlsâ€>Required</a>) on the current form. This code is placed in the form submission method (i.e. submitButton_Click) and placed before page validation (Page.IsValid), as in the following example
bool bIsValidChecked = CheckBox_Pickup_Option1.Checked || CheckBox_Pickup_Option2.Checked;
if (!bIsValidChecked )
Response.Write (“<script type=\”text/ecmascript\”>window.location.href = ‘#checkbox_controls’;</script>”);
// Set order time and session variables from the order form.
if (Page.IsValid & bIsValidChecked )
// form processing code
This isnâ€™t the best solution, but its one that works quickly. I need to develop a custom control for validating checkboxes.