Wednesday, July 31, 2013

CheckBox Validation



<script language="javascript" type="text/javascript">
        function ValidateTandCs(source, args) {
            args.IsValid = document.getElementById('<%= optIn.ClientID %>').checked;
        }
</script>


<asp:CheckBox ID="optIn" runat="server"></asp:CheckBox>


asp:CustomValidator ID="valTandCs" ClientValidationFunction="ValidateTandCs"  runat="server"
 ErrorMessage="Agree term and condition"></asp:CustomValidator>

No comments:

Post a Comment