Search code examples
telerikradwindow

telerik - how to refresh child 1 window after child 2 window close


Please help me! I have 1 apsx page and 2 uc. From aspx can open radwindow contain uc 1, from uc 1 can open uc 2. in aspx, i have:

function CloseRadWindow()
    {
        if(GetRadWindowManager().getActiveWindow() == null)
        {
            refreshGridGiaoDuToan(); //this one refresh aspx page from uc 1
        }
        else
        {
//i hope this one fresh uc1 after close uc2 but error
            var wnd2 = GetRadWindowManager().getWindowByName("wndPopup2");
            console.log(wnd2);
            wnd2.get_contentFrame().contentWindow.refreshGridNhiemVu();
        }

    }

    function refreshGridGiaoDuToan() {
        $find("<%= pnGiaoNganSach.ClientID %>").ajaxRequest("SoGiao");
    } 

On uc 1 i have

   function refreshGridNhiemVu() {
    alert("va");
    $find("<%= pnGiaoNganSachChiTiet.ClientID %>").ajaxRequest("RefreshNhiemVu");
}

But when i close uc 2, is always error: get_contentFrame().contentWindow.refreshGridNhiemVu is not funtion...

So my question is how to refresh (call function in codebehind) uc 1 after close uc2? Please help me! Thank!


Solution

  • Generally, this approach is correct. You must make sure the correct RadWindow instances are referenced and you can add some checks whether the function exists to avoid errors:

    which you can extend with a typeof check to make sure the variable is a function before calling it.