top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How do I make a checkbox required on an ASP.NET form?

+2 votes

How do I make a checkbox required on an ASP.NET form?

posted May 26, 2014 by Khusboo

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
Best answer
<html xmlns="">
<head id="Head1" runat="server">
    <script type = "text/javascript">
        function ValidateCheckBox(sender, args) {
            if (document.getElementById("<%=CheckBox1.ClientID %>").checked == true) {
                args.IsValid = true;
            } else {
                args.IsValid = false;
    <form id="form1" runat="server">
    <asp:CheckBox ID="CheckBox1" runat="server" />
    <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Required" ClientValidationFunction = "ValidateCheckBox"></asp:CustomValidator><br />
    <asp:Button ID="Button1" runat="server" Text="Submit"/>
answer Nov 18, 2014 by Manikandan J
Similar Questions
+2 votes

If somke error occurs i want the system to redirect to some other page and not show he error message.

   defaultRedirect="~/Error.aspx" />

This is not working.

+2 votes

How do I properly align pdf...?? I have different tables for different run..

0 votes

How to get all values along with control Id using Jquery in ASP.NET?

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.