RadConfirm on OnTabselecting Issue

6 posts, 0 answers
  1. vinod chandran
    vinod chandran avatar
    4 posts
    Member since:
    Sep 2009

    Posted 08 Oct 2009 Link to this post


    function OnClientTabSelecting(sender, eventArgs) {  
    var tab = eventArgs.get_tab();  
    var navigateUrl = tab.get_navigateUrl();  
    if (navigateUrl && navigateUrl != "#" && dataChangeField.value == "true") {  
    var proceed = tabConfirm(Click OK to proceed or Cancel to stay on current page.',eventArgs, 330, 100, '', "Change");
    if (!proceed) {  
    eventArgs.set_cancel(true);  
    }  
    else {  
    eventArgs.set_cancel(false);  
    dataChangeField.value = "false";  
    }  
    }  
     
    window.tabConfirm = function(text, ev, oWidth, oHeight, callerObj, oTitle) {  
    var callerObj = ev._tab._linkElement;  
    if (callerObj) {  
    //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.   
    var callBackFn = function(arg) {  
    if (arg) {  
    callerObj["onclick"] = "";  
    if (callerObj.click) callerObj.click(); //Works fine every time in IE, but does not work for links in Moz   
    else if (callerObj.tagName == "A"//We assume it is a link button!   
    {  
    try {  
    eval(callerObj.href)  
    }  
    catch (e) { }  
    }  
    }  
    }  
    radconfirm(text, callBackFn, oWidth, oHeight, callerObj, oTitle);  
    }  
    return false;  
    }  
     

    The requirement is to show a rad confirm window on tab change event. When user clicks OK he/she will be navigated to the clicked tab, on cancel user will remain on current tab itself. The issue is here is radConfirm() is not returning true properly - in OnClientTabSelecting event I am checking whether radConfirm result is true or false and calling set_cancel() method. I am unable to capture the OK button click and set the value here. Would appreciate any inputs on this - this is urgent.

    Thanks,
    Aneesh
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Oct 2009 Link to this post

    Hi Aneesh,

    I tried another approach to accomplish the scenario. Have a look at the code that I tried for displaying RadConfirm on selecting the tab.

    JavaScript:
     
    <script type="text/javascript"
        var tab, check = false
        function OnClientTabSelecting(sender, args) { 
            tab = args.get_tab(); 
            if (tab.get_text() == "ParentTab2" && !check) {  // Check for your condition and another bool value check 
                radconfirm("Hi", callBackFn, 500, 100, """"); 
                args.set_cancel(true);   // cancel the tab selection 
            } 
            if (check) { 
                check = false
            } 
        } 
        function callBackFn(arg) { 
            if (arg) { 
                var tabStrip = $find("<%= RadTabStrip1.ClientID %>"); 
                check = true
                tab.select(true); // explicitly selecting the tab 
            } 
        }   
    </script> 

    -Shinu.
  3. Aneesh Pulukkul
    Aneesh Pulukkul avatar
    4 posts
    Member since:
    Oct 2009

    Posted 13 Oct 2009 Link to this post

    function callBackFn(arg) {    
            if (arg) {    
                var tabStrip = $find("<%= RadTabStrip1.ClientID %>");    
                check = true;    
                tab.select(true); // explicitly selecting the tab    
            }    
        }      
     

    Thanks for your inputs. tab.select(true) doesn't select the tab. However, when make it tab.select() or tab.select(false), it selects the first tab and doesn't display the PageView content. I am using nested tabs and navigate url for each tab.
  4. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 13 Oct 2009 Link to this post

    Hello Aneesh Pulukkul,

    Please use the click() method instead, i.e.

    tab.click();

    Best wishes,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Aneesh Pulukkul
    Aneesh Pulukkul avatar
    4 posts
    Member since:
    Oct 2009

    Posted 13 Oct 2009 Link to this post

    I tried that - same problem persists. That is, the tab strip is not visible now.  I think the click action works but due to some other reason, the tab strip is going off the page.
  6. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 13 Oct 2009 Link to this post

    Hi Aneesh Pulukkul,

    I think it will be best if you can open a support ticket and send us a simple running project (incl. CSS, images, skins, DB backup if needed and so on) demonstrating the problem (and step-by-step instructions on doing so). In that way we can reproduce and pinpoint the problems you're facing on our side, understand the logic of your application and provide a solution.

    Sincerely yours,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top