Updating RadAjaxPanel from jQuery

542 Views Asked by At

I have a RadGrid control inside a RadAjaxPanel. In my jquery code, I make an ajax request to add a new record to RadGrid. It's added sucessfuly. However, it doesn't show up on the page even though I update RadAjaxPanel through the code below.

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

I see that RadAjaxPanel is updated but new record isn't there.I have to refresh the whole page to have the new record show up. Is there any way to do it without refresh?

1

There are 1 best solutions below

0
On

The RadGrid may need to have Rebind called for it.

I have a JavaScript function inside a RadCodeBlock on my page that I'd call before updating the RadAjaxPanel:

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

Then in the code behind:

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