Make OnClientTabSelecting wait for a radconfirm result

4 posts, 0 answers
  1. Angelo
    Angelo avatar
    4 posts
    Member since:
    Oct 2011

    Posted 25 Oct 2012 Link to this post

    Hi ... I'm trying to put in a confirmation popup when a user tries to move from a tab to a different one - the popup box is mainly to ask if they want to save their data or not or cancel the tab move. A code snippet is below (my company is still on the classic RadTabStrip - RadTabStrip.Net2):

    var tabConfirmResult;
     
     
    function onClientTabSelecting(sender, eventArgs) {
     OpenConfirmIfIsDirty('MilestonesTab', clientJobTabCallback); // Displays the radconfirm
     if (tabConfirmResult == 'cancel') {
         return false;
     }
    }
     
     
    function clientJobTabCallback(radWindow, returnValue) {
     tabConfirmResult = radWindow;
     if(radWindow=='cancel') {
         return;
     } else {
         if (radWindow == true) {
             // Do processing here for Save.
         }
         return;
     }
    }


    The problem is that after calling on the 'OpenConfirmIfIsDirty' function, the code goes straight to the next lines, finishes this function and goes to the next tab while the radconfirm page is still displayed in the foreground.

    How do I make it wait for the user to click on the radconfirm popup?



  2. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 30 Oct 2012 Link to this post

    Hi Angelo,

    In order to achieve the desired functionality, I could suggest you to use the RadConfirm dialog. I have prepared a sample project for you. Please find it attached.

    Kind regards,
    Nencho
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kwok (Andrew)
    Kwok (Andrew) avatar
    10 posts
    Member since:
    Oct 2012

    Posted 21 Jan 2013 Link to this post

    Nencho,
    I had take a look your sample project, but I still have a problem with it. Hope you can help me on it.
    The problem is that, if the controls in each pageview is another webpage (included by controlUrl), how do i call the save function from the webpage. I try to inserted the following code beflow "perform save here" in your sample project. but it call the webpage with "isPostBack = false".

    Also I find that the code behind onTabClick will not be fire. Is it due to the eventArgs.set_concel(true)?
    //Perform save here
    var multiPage = $find("<%= RadMultiPagetab.ClientID %>")
    var pageView = multiPage.get_selectedPageView();
    var myDoc = pageView.get_element();
    myDoc.document.forms[0].submit();
    currentlySelectedTab.set_selected(true);
  5. Kwok (Andrew)
    Kwok (Andrew) avatar
    10 posts
    Member since:
    Oct 2012

    Posted 22 Jan 2013 Link to this post

    I had solve problem relate to the onTackClick not fire by modify the code from currentlySelectedTab.set_selected(true) to currentlySelectedTab.click().
    Also after I take a look the link below, I see how to submit my webfrom inside the radpageview.
    http://www.telerik.com/community/forums/aspnet-ajax/tabstrip/aspx-page-inside-radpageview.aspx
Back to Top