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

Returning False Not Canceling Tab Select

1 Answer 44 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Jon (I.T. Agility Inc.)
Top achievements
Rank 1
Jon (I.T. Agility Inc.) asked on 21 Aug 2008, 04:11 PM
I am trying to provide a confrimation prompt that would allow a user a second affirmation before actually changing tabs.  Problem is it doesn't work, no matter what the user does, the tab is selected and the server event is fired.

      
    function ClientTabSelecting(sender, eventArgs)  
    {  
       var tabStrip = sender;  
       var tab = eventArgs.Tab;  
       return confirm("Are you sure you want to navigate away from this page?");  
         
    } 

<

telerik:RadTabStrip ID="RadTabStrip1" Width="100%" runat="server" Skin="Hay" OnClientTabSelecting="ClientTabSelecting" multipageid="RadMultiPage1" AutoPostBack="false" PerTabScrolling="true" ScrollButtonsPosition="Middle" />

 protected override void OnInit(EventArgs e)  
    {  
        base.OnInit(e);  
        RadTabStrip1.TabClick += new RadTabStripEventHandler(TabClicked);  
    } 

1 Answer, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 22 Aug 2008, 07:23 AM
Hi ,

I suggest you edit the code by the following way:

function ClientTabSelecting(sender, eventArgs)     
    {     
       var tabStrip = sender;     
       var tab = eventArgs.get_tab();     
       eventArgs.set_cancel(confirm("Are you sure you want to navigate away from this page?") )  ;  
            
    }    
 

Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TabStrip
Asked by
Jon (I.T. Agility Inc.)
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Share this question
or