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

RadConfirm on OnTabselecting Issue

5 Answers 97 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
vinod chandran
Top achievements
Rank 1
vinod chandran asked on 08 Oct 2009, 07:07 PM

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

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Oct 2009, 11:05 AM
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.
0
Aneesh Pulukkul
Top achievements
Rank 1
answered on 13 Oct 2009, 07:03 AM
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.
0
Paul
Telerik team
answered on 13 Oct 2009, 08:32 AM
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.
0
Aneesh Pulukkul
Top achievements
Rank 1
answered on 13 Oct 2009, 08:56 AM
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.
0
Paul
Telerik team
answered on 13 Oct 2009, 09:29 AM
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.
Tags
TabStrip
Asked by
vinod chandran
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Aneesh Pulukkul
Top achievements
Rank 1
Paul
Telerik team
Share this question
or