set_modal() not working on subsequent windows after modal window

3 posts, 1 answers
  1. Mike
    Mike avatar
    20 posts
    Member since:
    Jan 2011

    Posted 15 Feb 2012 Link to this post

    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. Answer
    Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 20 Feb 2012 Link to this post

    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 >>
  3. Mike
    Mike avatar
    20 posts
    Member since:
    Jan 2011

    Posted 20 Feb 2012 Link to this post

    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.
Back to Top