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!
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:
see this on having several RadWindowManagers which may be a cause for wrong references: http://www.telerik.com/help/aspnet-ajax/window-troubleshooting-wrong-window-opened.html
see here on creating the parent-child hierarchy: http://www.telerik.com/support/code-library/creating-parent-child-relationships-between-radwindows-and-passing-data-between-them
here is a bunch of checks before calling the function that can avoid the error:
if (wnd2.get_contentFrame && wnd2.get_contentFrame() &&
wnd2.get_contentFrame().contentWindow &&
wnd2.get_contentFrame().contentWindowrefreshGridNhiemVu) {
wnd2.get_contentFrame().contentWindow.refreshGridNhiemVu();
}
which you can extend with a typeof check to make sure the variable is a function before calling it.