从jQuery更新RadAjaxPanel

时间:2015-01-05 22:17:05

标签: jquery ajax telerik radgrid radajaxmanager

我在 RadAjaxPanel 中有一个 RadGrid 控件。在我的jquery代码中,我发出一个ajax请求来向RadGrid添加一条新记录。它增添了很多。但是,即使我通过以下代码更新RadAjaxPanel,它也不会显示在页面上。

var panel = <%= ajaxPanel.ClientID %>;  
panel.ajaxRequest('<%= ajaxPanel.UniqueID %>',''); 

我看到RadAjaxPanel已更新但新记录不存在。我必须刷新整个页面才能显示新记录。有什么办法可以不刷新吗?

1 个答案:

答案 0 :(得分:0)

RadGrid可能需要Rebind调用它。

我的页面上的RadCodeBlock中有一个JavaScript函数,我在更新RadAjaxPanel之前调用它:

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

然后在后面的代码中:

Protected Sub RadAjaxManager1_AjaxRequest(sender As Object, e As AjaxRequestEventArgs)
    Dim RadGrid1 As RadGrid = rgdPeople

    If e.Argument = "Rebind" Then
        RadGrid1.MasterTableView.SortExpressions.Clear()
        RadGrid1.MasterTableView.GroupByExpressions.Clear()
        RadGrid1.Rebind()
    End If
End Sub
相关问题