【问题标题】:Rebind Radgrid does not refresh when radwindow closesradwindow 关闭时重新绑定 Radgrid 不刷新
【发布时间】:2012-12-26 06:49:11
【问题描述】:

一旦通过母版页关闭了 radwindow,我正在尝试重新绑定我的网格。我的网格位于 aspx 页面中的用户控件中。在母版页中我有:

 function CancelEdit() {
            GetRadWindow().Close();
        }

        function CloseAndRebind() {
            GetRadWindow().BrowserWindow.refreshGrid(); // Call the function in parent page 
            GetRadWindow().close(); // Close the window 
        }

        function refreshGrid() {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");
        }

我在用户控件中有以下 javascript:

<script type="text/javascript" language="javascript">
    function refreshGrid() {
        $find("<%= RadAjaxManager.GetCurrent(me.Page).ClientID %>").ajaxRequest("Rebind");
    }

</script>

一旦我在 radwindow 中关闭更新数据库,我就会注册一个 javascript:

 ScriptManager.RegisterStartupScript(Page, Page.GetType(), "mykey", "CloseAndRebind();", True)

我可以看到我的数据源发生了变化,但网格没有更新。有什么建议吗?

编辑::

The structure is something like this:

I have master page which has the RadAjaxManager.
There is a main page which has a user control
Another user control inside above user control which has the RadGrid
Then there is an aspx page that opens as radwindow

【问题讨论】:

    标签: asp.net telerik master-pages radgrid radwindow


    【解决方案1】:

    使用客户端 API 重新绑定您的网格,应该是这样做的正确方法:

    在您的子页面中:

        function refreshGrid() {
            $find("<%= YourGrid.ClientID %>").get_masterTableView().rebind();
        }
    

    要从父页面调用 javascript 函数,只需使用以下代码:

        function CloseAndRebind() {
            GetRadWindow().get_contentFrame().contentWindow.refreshGrid(); // Call the function in parent page 
            GetRadWindow().close(); // Close the window 
        }
    

    【讨论】:

    • 将用户控件的 refreshgrid 更改为此,但仍然不刷新
    • 如果达到 javascript,然后尝试使用 RadAjaxManager 刷新控件。
    • 我可以看到在母版页上的 refreshGrid() 被调用,但在用户控件上却没有..
    • 查看编辑后的答案,父页面不需要refreshGrid函数,只需要在子页面中,然后可以从GetRadWindow()函数访问。
    猜你喜欢
    • 2012-05-21
    • 2023-03-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-01
    • 2013-12-15
    相关资源
    最近更新 更多