This is a migrated thread and some comments may be shown as answers.

Ajax Request not ReBinding Grid

1 Answer 71 Views
Window
This is a migrated thread and some comments may be shown as answers.
Steve Humby
Top achievements
Rank 1
Steve Humby asked on 26 Mar 2009, 06:03 PM
Hi

I am using the RadWindow "Edit Dialog for RadGrid" example and all is going well until the ajax request to rebind the grid - i get the following error:

Sys.WebForms.PageRequestManagerServerException: Object variable or with block variable not set.

I believe the section causing the problem is:

 

 

function refreshGrid(arg) {

 

 

if (!arg) {

 

$find(

"<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");

 

}

 

else {

 

$find(

"<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");

 

}

}

in the vb pages i have the following code:

 

Protected

 

Sub RadAjaxManager1_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs) Handles RadAjaxManager1.AjaxRequest

 

 

If e.Argument = "Rebind" Then
RadGrid1.Rebind()

 

 

ElseIf e.Argument = "RebindAndNavigate" Then
RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount

 

RadGrid1.Rebind()

 

End If

 

 

End Sub

I have set RadAjaxManager1 to update RadGrid1 in the RadAjaxManager but get the error - does anyone have an idea why this happens? The database is being updated and the grid displays the correct data once the page is refreshed.

Many thanks in advance

Steve :o)

 

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 31 Mar 2009, 08:22 AM
Hello Steve,

Your code seems all right, except for the following assignment:

RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount 

It should be:

RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1 

However, I believe this is just a type.

Could post your complete aspx and code behind, but, please, use the Format Code Block tool of the text editor.

Thank you.

Sincerely yours,
Tsvetoslav
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Steve Humby
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or