Validating a checkbox in asp net c
Here I am going to show a simple way of checking if any of the checkbox list items is selected or not.It is quite common scenario wherein a form contains checkbox list and that selecting at least one of the options from list is mandatory.
Net MVC4 Razor application using custom server-side and client-side validation.In this article I explain how you can validate that at least one checkbox is checked in an asp: Check Box List using an asp: Custom Validator, and how to make it work server side and client side.None of the built in validators will validate the asp: Check Box List, so you will have to create your own.Follow the following steps for validating checkbox in mvc razor.public class Registration Model //Making Custom attribute for validating checkbox // IClient Validatable for client side Validation public class Must Be True Attribute : Validation Attribute, IClient Validatable Now, you have applied the custom validation to the checkbox.In this article I have used asp.net, c#.net, sql server database, Java Script.
Grid View - Delete Selected Row Record From Data Base On Button Click in Using C#.
So you have to validate ASP Check Box List by Custom Validator.
Please elaborate your requirement if it doesn't help.
This validation works for client-side and server side.
I hope you will enjoy the tricks while programming with MVC Razor.