Validating checkboxes in asp net
So you have to validate ASP Check Box List by Custom Validator.Please elaborate your requirement if it doesn't help.
Net MVC it can not always be obvious what the best approach to take is. Net MVC team gave us the support to create a really simple solution when they added inheritable validation classes to the framework.
You would loose consistency in displaying validation errors.
[Validate At Least One Checked(new string , Error Message Resource Type=typeof(Error Message Resources), Error Message Resource Name="Select At Least One Topic")] public bool Checkbox1 public bool Checkbox2 public bool Checkbox3 public bool Checkbox4 The aim was to get the check boxes all validating and keep the validations and their localization contained in the View Model.
This is working, my only concern is that I expected to find an easy google-paste piece of code for this and did not... As a secondary question I am attaching this to only one checkbox field, which I think is fine; but is there any unintended consequences of that (other than that any I'll answer your second question first!