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

Problem opening a modal RadWindow from a RadComboBox

2 Answers 100 Views
Window
This is a migrated thread and some comments may be shown as answers.
dave
Top achievements
Rank 1
dave asked on 03 Nov 2011, 09:30 PM

I’ve been pulling out my limited hair over this problem, so I need some help.  I’m getting different RadWindow behavior, from the same code, depending on what control was used to invoke that code.  In one case, the newly displayed window is modal, in another case it is not modal.  But it’s the same code!

Here’s the setup:

The master page contains nothing related to RadWindow.

Top-level page includes the RadWindowManager declaration:

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista"

style="z-index:20000"

       Width="600px" AutoSize="true" ReloadOnShow="true" Modal="true"

       VisibleStatusbar="false" Behaviors="Resize, Close, Move" >

</telerik:RadWindowManager>

The top-level page opens the first RadWindow using this client code

var wnd = GetRadWindowManager().open(urlToOpen);

This consistently works fine, gives me a modal window, and dims the entire browser window.  This first RadWindow does NOT contain any declarations related to RadWindow.  This first RadWindow opens a second RadWindow.  I want the second RadWindow to also be modal.  The code that I’m using to open the second RadWindow is:

    var oManager = GetRadWindow().GetWindowManager();   <<< GetRadWindow is from the demo

    var oWnd;

    setTimeout(oWnd = function (p1) {

        return oManager.open(p1, null);   <<< null or “foo”, no difference

    }(urlToOpen), 0);

This code is pretty similar to the demo about opening a window from inside a window.  The first RadWindow form calls this code either from an asp.net Button client click event or from a RadComboBox client SelectedIndexChanging event.  Really, the same code!

The second RadWindow does not contain any declarations related to RadWindows.

When the button click opens the second RadWindow, it works great.  The displayed window is modal, on top, and the browser window is dimmed an additional amount.  When the same code is called from the RadComboBox SelectedIndexChanging event, the RadWindow is displayed with correct contents and size, however it is not modal (the first RadWindow is still active), it is initially displayed under the first RadWindow (should be on top), and the browser window is not dimmed an additional amount.  The two RadWindows can then be closed in either order.

The only thing that is really different is button vs RadComboBox.  Both controls are contained in cells of a DetailsView.  Both controls are created dynamically.  I’ve checked the intermediate values in the JS code and both get the same window ID and manager ID (using get_id() for both).  The second-level RadWindow gets a new ID each time it is displayed, which is expected.  This happens in both IE and FF.

This appears to be tied to the RadComboBox, since I get the same non-modal behavior from a different first RadWindow that has a RadComboBox in a RadGrid template column.  Both of the first-level RadWindows open the same second RadWindow.  The second RadWindow contains a dynamically generated RadGrid but has no knowledge (that I know about) of how it was invoked (both the button and the RadComboBox generate the same url).

Any ideas on how to always get the modal behavior?

Thanks,
DaveL

2 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 07 Nov 2011, 12:30 PM
Hello Dave,

Please try with the following syntax to ensure the script is called correctly and the correct parameter is passed:
setTimeout(function () 
{
    oWnd = oManager.open(url, null);
}, 0);

I tried this scenario and things seem to be working fine with me: http://screencast.com/t/bs7OEgWM9o. I am also attaching my test page. If you are still experiencing difficulties please modify it to the point it displays the unwanted behavior and send it back to me.

Kind regards,
Marin
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
dave
Top achievements
Rank 1
answered on 07 Nov 2011, 07:53 PM
Hi Marin,
Thanks for the response.  I agree that you sample files do work.  Pointing me back to the setTimeout function is the kick that I needed.

I needed the pointer to the window for some other code, so that's why I had changed the setTimeout call.  However, that change appears to have forced the setTimeout to run earlier than it should have.  By rearranging code (moving a couple of additional lines into the setTimeout function call), I now have the setTimeout running at the correct time and I use the pointer from the manager.open totally within the setTimeout call.  For example:

var oManager = OCMS_GetRadWindow().GetWindowManager();
var oWnd = null;
setTimeout(function () {
    oWnd = oManager.open(path, null);
    << code that uses oWnd >>
}, 0);

Thanks for the help!
DaveL
Tags
Window
Asked by
dave
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
dave
Top achievements
Rank 1
Share this question
or