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

set_modal() not working on subsequent windows after modal window

2 Answers 129 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 15 Feb 2012, 04:41 PM
Hi there,

I'm working on an app that has a RadWindowManager on a master page. This is used to open some detail windows in a non-modal way, which also updates a count of open windows, which can be re-opened, blah blah blah.

The issue occurs when a modal window is opened (via radopen) from a widget placed on the page, which uses the Master Page's RadWindowManager by design, and the window is set modal via script. The user continues their work, closes the window, and everything's fine.

However, the next time the user opens the detail window, it is now modal, despite being explicitly set to non-modal via set_modal(false). In fact, the window itself reports isModal == false, but is still displayed modally.

The RadWindowManager (on the Master page) is as follows:

<telerik:RadWindowManager ID="rwmRecord" runat="server" Height="500" Width="900"
    ShowOnTopWhenMaximized="false" Behaviors="Close,Move,Resize,Maximize,Reload,Minimize"
    ReloadOnShow="true" ShowContentDuringLoad="false" VisibleStatusbar="false" EnableShadow="true"
    OnClientClose="OnClientClose" OnClientCommand="OnClientCommand">

Any thoughts?

2 Answers, 1 is accepted

Sort by
0
Accepted
Svetlina Anati
Telerik team
answered on 20 Feb 2012, 10:28 AM
Hello Mike,

I made a sample page based on your explanations but unfortunately to no avail. The test code below works as expected:

<%@ Page Language="C#" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function OnClientClose(sender, args) {
            sender.set_modal(false);
        }
 
        function OnClientCommand() {
        }
 
        var explicitlySetModal = true;
 
        function OpenWin() {
            var oWnd = radopen("http://www.telerik.com", "detailWindow");
            alert(oWnd.isModal()); //we check for modality before setting tryue - this will and should be always false
            oWnd.set_modal(explicitlySetModal);
            explicitlySetModal = false;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="ScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadWindowManager ID="rwmRecord" runat="server" Height="500" Width="900"
        ShowOnTopWhenMaximized="false" Behaviors="Close,Move,Resize,Maximize,Reload,Minimize"
        ReloadOnShow="true" ShowContentDuringLoad="false" VisibleStatusbar="false" EnableShadow="true"
        OnClientClose="OnClientClose" OnClientCommand="OnClientCommand">
        <Windows>
            <telerik:RadWindow ID="detailWindow" runat="server">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <asp:Button ID="b" runat="server" OnClientClick="OpenWin(); return false;" Text="Open RadWindow" />
    </form>
</body>
</html>

 

The only things I can assume without examining sample code are the following ones:

1) Make sure that when you open the RadWindow the second time you do not execute set_modal again (this is simulated by using a js flag in the code above).

2) In case you have more than one RadWindowManager controls on the resultant page, make sure that you open the RadWindow from the correct RadWindowManager - more information is available here:

http://www.telerik.com/help/aspnet-ajax/radwindow-troubleshooting-wrong-window-opened.html

In case this does not help, please modify my code or send me fully runnable reproduction source along with detailed explanations and I will help you achieve what you need.

Greetings,
Svetlina Anati
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Mike
Top achievements
Rank 1
answered on 20 Feb 2012, 05:44 PM
That's great, it lead me to the fact that other windows were being opened and .set_modal(true) was being called on them, I altered their window close event code as shown by yourself, and it all works just fine now.

Thank you,

Mike K.
Tags
Window
Asked by
Mike
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Mike
Top achievements
Rank 1
Share this question
or