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

Make OnClientTabSelecting wait for a radconfirm result

3 Answers 91 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Angelo
Top achievements
Rank 1
Angelo asked on 25 Oct 2012, 11:34 PM
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?



3 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 30 Oct 2012, 01:54 PM
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.
0
Kwok (Andrew)
Top achievements
Rank 1
answered on 21 Jan 2013, 07:51 PM
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);
0
Kwok (Andrew)
Top achievements
Rank 1
answered on 22 Jan 2013, 08:02 PM
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
Tags
TabStrip
Asked by
Angelo
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Kwok (Andrew)
Top achievements
Rank 1
Share this question
or