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

Sys.WebForms.PageRequestManagerServerErrorException: Invalid JSON primitive: Rebind.

1 Answer 265 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vikas Kamble
Top achievements
Rank 1
Vikas Kamble asked on 25 Nov 2011, 02:15 PM
Error : Sys.WebForms.PageRequestManagerServerErrorException: Invalid JSON primitive: Rebind.

In one of our project requirement we have customized the SPRADGRID webpart and have created our own webpart. We are facing some issues with Ajax request. 

The rad grid is bound to an SharePoint list. and we are calling the ShowEditInsertForm to open the Edit And Add form for the list. when we submit the form. We are trying to refresh the grid through ajax request when the model pop is closed. we get the above mentioned error when the ajax request completes its execution.




below is some part from the code.

Ajax Manager ajax request code
      void AjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {
            if (e.Argument == "Rebind")
            {
                this.Grid.Rebind();
            } 
        }


JavaScript Code to raise the request
function refreshGrid(arg)
{
    if (!arg)
    {
        ajaxManagerClientId = 'ctl00_RadAjaxManager1';
        $find(ajaxManagerClientId).ajaxRequest();
    }
    else
   {
        ajaxManagerClientId = 'ctl00_RadAjaxManager1';
        $find(ajaxManagerClientId).ajaxRequest();
    }
}


1 Answer, 1 is accepted

Sort by
0
Vikas Kamble
Top achievements
Rank 1
answered on 27 Nov 2011, 03:45 PM
I resolved the issue by looking at one of the post in this forum. While making the ajax request and passing arguments i think its needs to be passed in a different way.

function refreshGrid(arg) {
    if (arg) {
        ajaxManagerClientId = 'ctl00_RadAjaxManager1';
        var parameters = {};
        parameters.Request = "Rebind";
        var json = Sys.Serialization.JavaScriptSerializer.serialize(parameters);

        $find(ajaxManagerClientId).ajaxRequest(json);
    }
}

i have highlighted the changes i have made in the code. now the Ajax request works perfectly.
Tags
Grid
Asked by
Vikas Kamble
Top achievements
Rank 1
Answers by
Vikas Kamble
Top achievements
Rank 1
Share this question
or