This is a migrated thread and some comments may be shown as answers.

call javascript function in rad tab OnClientTabSelecting

1 Answer 80 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
sathish
Top achievements
Rank 1
sathish asked on 03 Jun 2009, 04:40 AM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Jun 2009, 10:27 AM
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.
Tags
TabStrip
Asked by
sathish
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or