RadWindow - check if opened

7 posts, 1 answers
  1. Mihai
    Mihai avatar
    16 posts
    Member since:
    Oct 2011

    Posted 23 Apr 2013 Link to this post

    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
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Apr 2013 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mihai
    Mihai avatar
    16 posts
    Member since:
    Oct 2011

    Posted 23 Apr 2013 Link to this post

    Thanks Shinu,

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

    Any ideas?
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Apr 2013 Link to this post

    Hi,

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

    Thanks,
    Shinu
  6. Mihai
    Mihai avatar
    16 posts
    Member since:
    Oct 2011

    Posted 24 Apr 2013 Link to this post

    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?
  7. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    3596 posts

    Posted 24 Apr 2013 Link to this post

    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.
  8. Mihai
    Mihai avatar
    16 posts
    Member since:
    Oct 2011

    Posted 24 Apr 2013 Link to this post

    Thank you!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017