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

How to open to modal windows at same time

1 Answer 58 Views
Window
This is a migrated thread and some comments may be shown as answers.
randall
Top achievements
Rank 1
randall asked on 08 Jul 2013, 05:03 PM
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?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 10 Jul 2013, 11:05 AM
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.
Tags
Window
Asked by
randall
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or