一旦通过母版页关闭了一个radwindow,我正试图重新绑定我的网格。我的网格位于aspx页面的usercontrol中。在母版页中我有:
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
答案 0 :(得分: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
}