How to open to modal windows at same time

2 posts, 0 answers
  1. randall
    randall avatar
    40 posts
    Member since:
    Apr 2009

    Posted 08 Jul 2013 Link to this post

    Hi,
    here is what we are doing....we have a master page that opens two modal windows.
    I am not having problems opening both...i am however wanting the behavor to be differnt if possible.

    when the master page opens the two modal windows A & B,   and stacks them in that order with B being the topmost.
    I would like A to be grayed out, or even invisible until modal B is closed. the problems is for A to reappear, i have to refresh the screen which i don't want to do...

    is there a way to hide, or gray out modal A, while B is active...then when B closes, enable or show A?

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 10 Jul 2013 Link to this post

    Hi Randall,

    You can use the client-side API of the RadWindows to hide() and show() them when needed. You can use the following logic, for example, and enhance it further to match your scenario and needs:
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" Modal="true" OnClientClose="lowerFlag" CenterIfModal="false">
                <ContentTemplate>
                    <asp:Button ID="Button2" Text="open second" OnClientClick="radopen(null, 'RadWindow2'); return false;"
                        runat="server" />
                </ContentTemplate>
            </telerik:RadWindow>
            <telerik:RadWindow ID="RadWindow2" runat="server" Modal="true" OnClientShow="hideFirst"
                OnClientClose="showFirst">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <asp:Button ID="Button1" Text="open first" OnClientClick="radopen(null, 'RadWindow1'); return false;"
        runat="server" />
    where setting the CenterIfModal to false for the first popup will make it remember its position when it is hidden.
    function hideFirst()
    {
        var first = GetRadWindowManager().getWindowByName("RadWindow1");
        first.hide();
        first.__isOnlyHidden = true;
    }
     
    function showFirst()
    {
        var first = GetRadWindowManager().getWindowByName("RadWindow1");
        if (first.__isOnlyHidden)
        {
            first.show();
            first.__isOnlyHidden = false;
        }
    }
     
    function lowerFlag(sender)
    {
        sender.__isOnlyHidden = false;
    }

    using hide() instead of close() will prevent the close event from firing unnecessarily and will keep the modal background from the first popup in place.


    Regards,
    Marin Bratanov
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top