call javascript function in rad tab OnClientTabSelecting

2 posts, 0 answers
  1. sathish
    sathish avatar
    1 posts
    Member since:
    Jul 2007

    Posted 02 Jun 2009 Link to this post

    I have a requirement that before navigating to the next tab validate one javascript in OnClientTabSelecting  if the javascript function value returns true then only i want to navigate to next tab if it returns false i want to be in the same tab with out postback or tab change
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 03 Jun 2009 Link to this post

    Hi Sathish,

    You can cancel the PostBack by using args.set_cancel(true) method as shown below.

    JavaScript:
     
    <script type="text/javascript"
    function OnClientTabSelecting(sender,args) 
        var result = MyFunction(); // Call the function 
        if(!result) 
        { 
            args.set_cancel(true); 
        } 
    </script> 

    Thanks,
    Shinu.
Back to Top