Since asp/ doesn’t have a form validator to check checkboxes we need to use a custom validator.
So here’s a very simple and crude way to achieve this

The 4 Guys From Rolla have an article on a more comprehensive way to do this, but if you don’t mind quick and dirty continue reading.
Their article can be found here :

// So you have something like this in the view to represent the checkbox to be validated and the CustomValidator
Confirm action

// then you place the Validation Method into the code-behind or a code block on the page.
protected void CustomConfirmationValidate(object source, ServerValidateEventArgs args)
  args.IsValid = ConfirmationCheckbox.Checked;

// and to control the actions you check for Page.IsValid before you do what you want to do.. i.e.
if (!Page.IsValid)
  // Page is invalid so we don't do anything.

One Response to A (very) simple way to validate a checkbox in

  1. Andrew Deniel says:


    This is very informative article. Thanks for sharing your knowledge. There are few links that also helpful for developers. This article have described to validate CheckBox, CheckBoxList, DropDownList, FileUpload, RadioButton, RadioButtonList, TextBox using jquery.