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

opening radwindow from radwindow as modal

19 Answers 1052 Views
Window
This is a migrated thread and some comments may be shown as answers.
Piyush Bhatt
Top achievements
Rank 2
Piyush Bhatt asked on 11 Apr 2008, 04:20 PM

I am opening a RadWindow from within RadWindow as per the examle.

The second radWindow opens up fine, but it opens in the background of the first window. I have to click on the second window then it comes up on the top.

I tried using setActive, setVisible, show - but none of them make the second window on top of first.

Any idea?
-Piyush

19 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 14 Apr 2008, 12:16 PM
Hi Piyush,

Can you please provide more details about your exact setup? How exactly you open these windows?



Sincerely yours,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Piyush Bhatt
Top achievements
Rank 2
answered on 14 Apr 2008, 03:04 PM

I use these functions to open the Rad window. Strangely, at some places RadWindow within RadWindow opens up fine. But only for the following openReferral() method its not opening up correctly and opening behind another RadWindow.

//used from ApptEdit.aspx for [Attach] button
function openReferral(patId, apptId)
{
    var url = 'AddEditReferral.aspx?PatientId=' + patId + '&AppointmentId=' + apptId;
    var owindow = OpenRadWindow(url, null, 650, 550);
    owindow.center();
    owindow.set_Title("Patient Referrals");
    owindow.setActive();
    owindow.set_Modal(true);
    return false;
}


//This code is used to provide a reference to the radwindow "wrapper"
function GetRadWindow()
{
   var oWindow = null;
   if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
   else if (window.frameElement && window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)
   return oWindow;
}

function OpenRadWindow(url, windowid, width, height)
{
    var owindow = GetRadWindow();
    var rwindow = null;
    if (owindow == null)
    {
        rwindow = radopen(url, windowid);
    }
    else
    {
        rwindow = owindow.BrowserWindow.radopen(url, windowid);
    }
    if (rwindow != null)
    {
        rwindow.setSize(width, height);
    }
    return rwindow;
}//OpenRadWindow
0
Georgi Tunev
Telerik team
answered on 16 Apr 2008, 02:43 PM
Hi Piyush,

Unfortunately I am still unable to reproduce the problem locally. Please open a support ticket and send me a small sample project where this behavior can be observed - I will check it right away and get back to you with solution.



Greetings,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Christian
Top achievements
Rank 1
answered on 16 Apr 2008, 06:01 PM
I am actually having the exact same problem.  I was trying to replicate the functionality from the "Communication between dialogs" and just can't get it to focus on the second window.  Below is the javascript I am using to open the dialogs (it is modeled off of the code):

Parent Page (works perfectly):
var oWnd = window.radopen(null, "ReplaceWindow");                    
//Create a new Object to be used as an argument to the radWindow
var arg = new Object();     
arg.TargetElementID = targetElement.id;
arg.BaseFileName = targetElement.attributes("FileName").value;
arg.CustomerID = targetElement.attributes("CustomerID").value;
                
//Set the argument object to the radWindow  
oWnd.Argument = arg;

oWnd.setUrl(oWnd.get_NavigateUrl());

Replace Window (first window) (this opens the second window but in the background and the first window is not "locked" as it is in the sample online):
var currentWindow = GetRadWindow();
var parentPage = currentWindow.BrowserWindow;
var parentRadWindowManager = parentPage.GetRadWindowManager();
                   
var generateWindow = parentRadWindowManager.open("Window_GenerateThumbnails.aspx","GenerateWindow");
      
//Set the current argument object to the new radWindow  
generateWindow.Argument = currentWindow.Argument;

generateWindow.setUrl(generateWindow.get_NavigateUrl());

---------------------

Any help would be greatly appreciated.
Thanks,
Christian

0
Piyush Bhatt
Top achievements
Rank 2
answered on 17 Apr 2008, 08:21 PM

I just observed a funny thing.

By replacing <asp:button> which is opening the RadWindow, with an HTML input button - it opens the window on the foreground. If I use <asp:Button> then it opens up in the background of the caller window.

Any clue?
-Piyush
0
Accepted
Svetlina Anati
Telerik team
answered on 21 Apr 2008, 10:40 AM
Hi,

Please, find the answers to your questions below:

  1. I was able to reproduce the difference you mention in the behavior of the standard asp button and the HTML input when opening RadWindow by clicking each of them. This behavior is related to browser specifics and not to the RadWindow control itself - you can get equal behavior in both cases if you set type="submit"  for the HTML input button.
  2. To set the focus to a RadWindow you need to call its setActive method with a boolean argument set to true. Furthermore, you should set a little timeout, actually a time interval equal to 0 will also do the trick. Below you can find a sample code snippet demonstrating how the focus should be set:

    function OpenSecondWindow()  
    {  
    var parentPage = GetRadWindow().BrowserWindow;  
    var secondWnd = parentPage.radopen('http://www.google.com','RadWindow2');  
    setTimeout(function(){secondWnd.setActive(true);}, 0);  
     

Greetings,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Stuart McLeod
Top achievements
Rank 1
answered on 15 May 2008, 11:33 AM
That all works fine, except with a modal dialog. It makes the top window modal but not any children. Any ideas? (I see this is probably a bug in the Q1 2008 release. I'll leave it with you.)
0
Svetlina Anati
Telerik team
answered on 17 May 2008, 11:56 AM
Hi Stuart,

The problem is due to browser specifics and the way the browser handles the button's click event. To avoid the problem, just set a timeout when opening the second window. Actually, a timeout of 0ms will do the trick.


For your convenience I am attaching a sample demonstration project.


Regards,
Svetlina
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Rob Conley
Top achievements
Rank 1
answered on 23 Jul 2008, 04:57 PM
This suggestion worked for me in the beta, but stopped working once I installed the Q1 release. I'm researching now.
0
Rob Conley
Top achievements
Rank 1
answered on 23 Jul 2008, 05:24 PM
Never mind... I had turned jscript debugging off and was not aware of a javascript error before the settimeout.
0
Paolo Brunino
Top achievements
Rank 1
answered on 29 Jul 2008, 03:28 PM
I had the same problem.
Setting the timeout got the opened radwindow on front but still it's not modal in respect to the radwindow that opened it.
I'm opening with an html image button, opening with a html input button gives no problem, the window opens on front (without any timeout trick) and modal.
Is there any way to get it modal with an image button calling it?

thank you
0
Svetlina Anati
Telerik team
answered on 30 Jul 2008, 07:52 AM
Hi Paolo,

I tested opening two modal RadWindows with an image button on the main page and with image buttons on the main page and on the dialog. In both test projects the modality worked as expected as you can see from the attached projects.

Please, examine them and in case you need further assistance, open a new support ticket and send me a reproduction project (or modify mine) along with a detailed explanation of the reproduction steps and some screenshots. Once I have a better understanding on your scenario I will do my best to help.


Sincerely yours,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Tye
Top achievements
Rank 1
answered on 16 Feb 2009, 08:27 PM
Hello. I was having the same problems but the solution you provided fixed the modal problems. However, I have an issue with the code you provided in sending arguments back from the second modal (Default3.aspx) to the first modal (Default2.aspx).

I modified the files you sent and added a third page (Default3.aspx). The desired flow is:

User clicks image in Default.aspx to launch first modal window, Default2.aspx.
User clicks image in Default2.aspx to launch second modal window, Default3.aspx.
User fills out text box in Default3.aspx and clicks "Save" button.
Default3.aspx is dismissed and passes the text box value as an argument to Default2.aspx.
Default2.aspx populates its own text box with the value passed in from Default3.aspx.

However, since the RadWindow is actually declared in Default.aspx (which after much testing is apparently how you fixed the second modal window problem), and not Default2.aspx, OnClientClose is called from Default.aspx, and not Default2.aspx. Therefore Default2.aspx never gets the argument value...

Is there a way to keep the fix for the two modal windows and be able to pass an argument from Default3 to Default2?

Thanks,
Tye
0
Tye
Top achievements
Rank 1
answered on 17 Feb 2009, 06:54 PM
Nevermind, I found a way around it by using the get_contentFrame() method:

 

var oWnd = GetRadWindowManager().getWindowByName("Properties");

 

oWnd.get_contentFrame().contentWindow.CallbackFunction(arg);

When the OnClientClose method of the root page is loaded, I simply pass the returned argument object back to the first dialog using the CallbackFunction method I defined.

Thanks,

Tye

0
DW Web Team Member
Top achievements
Rank 2
answered on 04 Aug 2009, 01:57 PM
Thanks for the demo.  If you maximize the first rad window and then open the second rad window it does not open on top.  A working demo would be appreciated.  Thanks!
0
Fiko
Telerik team
answered on 04 Aug 2009, 02:12 PM
Hello,

I believe that this forum thread and the attached examples in it are exactly what you need.

Kind regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
DW Web Team Member
Top achievements
Rank 2
answered on 04 Aug 2009, 02:27 PM
Nope.  That one doesn't work either.  Although it says it addresses the problem.  When the first rad window is maximized and you click on the button to open the second rad window you get this javascript error...

Microsoft JScript runtime error: Sys.ArgumentTypeException: Object of type 'Object' cannot be converted to type 'Function'.
Parameter name: handler

In this function...

 

function Sys$EventHandlerList$addHandler(id, handler) {

 

/// <param name="id" type="String"></param>

 

/// <param name="handler" type="Function"></param>

 

var e = Function._validateParams(arguments, [

{name:

"id", type: String},

 

 

{name:

"handler", type: Function}

 

 

]);

 

 

 

if (e) throw e;

 

Array.add(

this._getEvent(id, true), handler);

 

 

 

}

 

 

0
Fiko
Telerik team
answered on 06 Aug 2009, 11:00 AM
Hello,

I reworked the project and reattached it to the current thread. Could you please check it and let me know whether it fits you requirement?


All the best,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
DW Web Team Member
Top achievements
Rank 2
answered on 07 Aug 2009, 02:07 AM
I don't particularly care for the approach, but it works.  The user shouldn't have their first rad window resized for them.  IMHO.
Tags
Window
Asked by
Piyush Bhatt
Top achievements
Rank 2
Answers by
Georgi Tunev
Telerik team
Piyush Bhatt
Top achievements
Rank 2
Christian
Top achievements
Rank 1
Svetlina Anati
Telerik team
Stuart McLeod
Top achievements
Rank 1
Rob Conley
Top achievements
Rank 1
Paolo Brunino
Top achievements
Rank 1
Tye
Top achievements
Rank 1
DW Web Team Member
Top achievements
Rank 2
Fiko
Telerik team
Share this question
or