Click here to Skip to main content
15,915,093 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Everyone,

I have page which generated dynamic control and also apply RequiredField Validation at runtime. Everything works fine but when i click on dropdown and page postbacks, Validations in javascripts always return true even though data isn't available in required Fields. But when i check in C# code , it returns false. Please note that i am using telerik controls

Here is the javascript code used by me :

JavaScript
function OnTabSelecting(sender, args)
  {
       
       // this always return true after postback where as returns false in c#
       alert(Page_ClientValidate('grp'+$get("<%= hfSelectedTab.ClientID%>")));

       
       if($get("<%=FrmDesignCheck.ClientID%>").checked == false)
       {
           if(Page_ClientValidate('grp'+$get("<%= hfSelectedTab.ClientID%>").value) == false )
           {
               //args.set_cancel(true);
           }
       }
  }


Any suggestion

Thanks,
Posted

1 solution

XML
function OnTabSelecting(sender, args)
  {

       // this always return true after postback where as returns false in c#
       alert(Page_ClientValidate('grp'+$get("<%= hfSelectedTab.ClientID%>")));


       if($get("<%=FrmDesignCheck.ClientID%>").checked == false)
       {
           if(Page_ClientValidate('grp'+$get("<%= hfSelectedTab.ClientID%>").value) == false )
           {
               //args.set_cancel(true);
           }
       }
return false;
  }



write return where you called the function

like
return OnTabSelecting();



try if it works...

Thanks
Ashish
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900