Loading ...

Server side validation stopped working

 /5
0 (0votes)

Yesterday i was working on a registration page where if a person check the checkbox where the terms and conditions are

written only then he/she can register .So i used a client side validation if a person doesn't select the checkbox then the

alert box will appear where it is written that  you must follow the terms and conditions.

 

 But on doing this the server side validations stopped working . I culdn't find the reason why was it happening .I searched

it on google as well but culdn't find the solution to it. Then one of my colleague told me to use Page.Validate() method and  

 Page.IsValid on the button click and it worked .

     

protected void btnRegister_Click(object sender, EventArgs e)

 

 {

            Page.Validate();

          if (Page.IsValid)
            {
                RegisterUser();
            }

}

 

Comments (1)

   
Shaitender
Using javascript , can give such error..
try using Custom validator for CheckBox!!!
12/29/2008
 · 
by

Top Posts