OnClientClose in RadWindowManager vs RadWindow?

5 posts, 0 answers
  1. Stephanie
    Stephanie avatar
    139 posts
    Member since:
    Aug 2013

    Posted 17 Sep 2013 Link to this post

    After spending 2 days trying to refresh the parent page when the rad window is closed. I was finally able to get somewhere. If I set the OnClientClose in the RadWindowManager my javascript function fires if I set it in the RadWindow it does not fire. Is this intended? What is the point of the OnClientClose in the RadWindow?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Sep 2013 Link to this post

    Hi Stephanie,

    Such a behavior is not expected. The OnClientClose event is called after the window is closed. If an argument is passed to the close() method, when it is called from JavaScript you can obtain this object via the get_argument() method of the event arguments object. Useful in dialog scenarios when closing the RadWindow from its content page. Please check the sample code I tried to invoke OnClientClose from RadWindowManager as well as from RadWindow. Also note that if you are attaching OnClientClose to RadWindowManager and a RadWindow inside the WindowManager, then the event attached to the corresponding RadWindow will be called on closing that particular RadWindow.

    ASPX:
    <telerik:RadWindowManager ID="RadWindowManager1" OnClientClose="OnClientClose" runat="server"
        Width="400px" Height="400px">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server">
            </telerik:RadWindow>
            <telerik:RadWindow ID="RadWindow2" runat="server" OnClientClose="OnClientClose1">
            </telerik:RadWindow>
        </Windows>
    </telerik:RadWindowManager>
    <telerik:RadButton runat="server" AutoPostBack="false" Text="Open RadWindow1" OnClientClicked="openRadWindow1">
    </telerik:RadButton>
    <telerik:RadButton runat="server" AutoPostBack="false" Text="Open RadWindow2" OnClientClicked="openRadWindow2">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function OnClientClose() {
            alert("Called from RadWindowManager");
        }
        function OnClientClose1() {
            alert("Called from RadWindow");
        }
        function openRadWindow1() {
            $find('<%=RadWindow1.ClientID %>').show();
        }
        function openRadWindow2() {
            $find('<%=RadWindow2.ClientID %>').show();
        }
    </script>

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Stephanie
    Stephanie avatar
    139 posts
    Member since:
    Aug 2013

    Posted 18 Sep 2013 Link to this post

    Well the OnClientClose is only called when I have that in the RadWindowManager tag. When I move it to the RadWindow tag it is not called and that is the only thing I change....Seems like a bug somewhere....
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 19 Sep 2013 Link to this post

    Hi Stephanie,

    Unfortunately I couldn't replicate this issue at my end and the code I posted works fine at my end. Are you able to replicate the unusual behavior with my code? Can you please post the code you tried so that I can investigate more into this issue?

    Thanks,
    Shinu.
  6. Denis
    Denis avatar
    0 posts
    Member since:
    Mar 2015

    Posted 27 Mar 2015 in reply to Shinu Link to this post

    Is this by design? If RadWindowManager has only one Window, then used eventhandler of "OnClientClose" from RadWindowManager, even if RadWindow has own event handler. Eventhandler from RadWindow used only when RadWindowManager.Windows has more then one windows 
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017