Ajax Request not ReBinding Grid

2 posts, 0 answers
  1. Steve Humby
    Steve Humby avatar
    16 posts
    Member since:
    Nov 2005

    Posted 26 Mar 2009 Link to this post

    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)

     

  2. Tsvetoslav
    Admin
    Tsvetoslav avatar
    1823 posts

    Posted 31 Mar 2009 Link to this post

    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.
Back to Top