Home > ASP.Net > Terms of Use CheckBox validation with CreateUser Control

Terms of Use CheckBox validation with CreateUser Control


Hi

try this example :

<script language="javascript" type="text/javascript">
   
        function AcceptTermsCheckBoxValidation(oSrouce, args)
        {
 var myCheckBox = document.getElementById('<%= (CreateUserWizard1.WizardSteps[0].Controls[0].FindControl("cbx_Accept") as CheckBox).ClientID %>');
            if(!myCheckBox.checked)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
       
     
   </script>

<tr>
       <td align="center" colspan="2" style="color: red; text-align: right">
             <asp:CheckBox ID="cbx_Accept" runat="server" ForeColor="#000000" Text="I accept terms of use" Font-Bold="True" /></td>
 </tr>
 <tr>
      <td align="center" colspan="2" style="color: red; text-align: right">
            <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="AcceptTermsCheckBoxValidation"
      ErrorMessage="Accept terms of use." ValidationGroup="CreateUserWizard1" Font-Bold="True"></asp:CustomValidator></td>
</tr>

Good Luck

Advertisements
Categories: ASP.Net
  1. February 9, 2009 at 10:34 pm

    Thank you

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: