Returning False Not Canceling Tab Select

2 posts, 0 answers
  1. Jon (I.T. Agility Inc.)
    Jon (I.T. Agility Inc.) avatar
    19 posts
    Member since:
    Feb 2007

    Posted 21 Aug 2008 Link to this post

    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);  
        } 
  2. Rosi
    Admin
    Rosi avatar
    2527 posts

    Posted 22 Aug 2008 Link to this post

    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.
Back to Top