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

RadWindow - check if opened

6 Answers 548 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mihai
Top achievements
Rank 1
Mihai asked on 23 Apr 2013, 08:31 AM
Hello,

GIVEN
- Using Telerik Q1 2013
- Using ASP.NET 4.5(C#)
- Using a RadWindowManager(and it's child windows) on the Master page

ISSUE
- Looking for a way of checking if any RadWindow is opened.

Thanks

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Apr 2013, 09:06 AM
Hi,

You can use getWindowByName method to check which window is opened. Check the following help documentation which expalins more about this.
RadWindowManager API

Thanks,
Shinu
0
Mihai
Top achievements
Rank 1
answered on 23 Apr 2013, 10:14 AM
Thanks Shinu,

I was actually looking for a way to check if any RadWindow is opened from codebehind.

Any ideas?
0
Shinu
Top achievements
Rank 2
answered on 24 Apr 2013, 04:30 AM
Hi,

You can check using the following condition.
c#:
if (RadWindow1.VisibleOnPageLoad == true)
{
 }

Thanks,
Shinu
0
Mihai
Top achievements
Rank 1
answered on 24 Apr 2013, 06:47 AM
Hello Shinu,

I tried your solution but, as imagined, it doesn't work because I'm opening the RadWindow client-side(using JS) and VisibleOnPageLoad is a server property.

A few days ago I saw the syntax RadWindowManager.Current.GetWindows() but couldn't get it to work with asp.net.

Any other ideas?
0
Accepted
Marin Bratanov
Telerik team
answered on 24 Apr 2013, 01:51 PM
Hi guys,

If all RadWindows on the page are opened through a RadWindowManager you can use the  GetRadWindowManager().getActiveWindow() method to see if there is an active window (i.e. a shown one).
You can try it out with the following simple code:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
</telerik:RadWindowManager>
<script type="text/javascript">
    function pageLoad()
    {
        var one = radopen();
        var two = radopen();
        var three = radopen();
        alert(GetRadWindowManager().getActiveWindow());
        one.close();
        two.close();
        three.close();
        alert(GetRadWindowManager().getActiveWindow());
    }
</script>

When it alerts null then there is no RadWindow opened. Comment out some of the close() calls and you will get the RadWindow object.

Note that this is a client-side method and such a check cannot be performed on the server. It can be done before a request is initiated and a flag in a hidden field can be raised to transfer the information to the code-behind.

Regards,
Marin Bratanov
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
Mihai
Top achievements
Rank 1
answered on 24 Apr 2013, 07:29 PM
Thank you!
Tags
Window
Asked by
Mihai
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mihai
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or