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

Error when sending JSON string via ajaxRequest() method

3 Answers 94 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 20 Dec 2012, 11:08 AM
I have the following JavaScript code that creates a really simple JSON object...

var data = {'MyID':1,'MyItem':'This is the first item'};
var JSONdata = JSON.stringify(data);
$find('<%= RadAjaxManager1.ClientID %>').ajaxRequest(JSONdata);

This generates the following JSON string after running the object through the stringify method...

{"MyID":1,"MyItem":"This is the first item"}

This is valid JSON according to JSONLint.com.

Calling the .ajaxRequest() method results in Sys.WebForms.PageRequestManagerServerErrorException - "Specified cast is not valid"

It's not even getting to my RadAjaxManager1_AjaxRequest() event handler where I have a breakpoint set to inspect the value of e.argument.

What's wrong here?

I'm using version 2010.3.1317.35 of the Telerik controls.

Rob  

3 Answers, 1 is accepted

Sort by
0
Rob
Top achievements
Rank 1
answered on 20 Dec 2012, 03:43 PM
Using Web Development Helper the callstack for this error is as follows:

at http://localhost:3391/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_ContentPlaceHolder1_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a553a4a13-b3a5-4e6b-a152-b131051f1788%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.3.1317.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3ad7b88a55-4248-43ee-a9ed-d9058fd97467%3a16e4e7cd%3a7165f74%3aed16cbdc [6]
    JScript anonymous function
0
Rob
Top achievements
Rank 1
answered on 20 Dec 2012, 05:02 PM
Further debug information - the error is occurring in code emitted into one of the Telerik.Web.UI.WebResource.axd's...

Error.create Telerik.Web.UI.WebResource.axd:6

Sys.WebForms.PageRequestManager._createPageRequestManagerServerError Telerik.Web.UI.WebResource.axd:15
Sys.WebForms.PageRequestManager._parseDelta Telerik.Web.UI.WebResource.axd:15
Sys.WebForms.PageRequestManager._onFormSubmitCompleted Telerik.Web.UI.WebResource.axd:15
(anonymous function) Telerik.Web.UI.WebResource.axd:6
(anonymous function) Telerik.Web.UI.WebResource.axd:6
Sys.Net.WebRequest.completed Telerik.Web.UI.WebResource.axd:6
_onReadyStateChange

The array of JSON objects that I was sending as the RadAjaxManager's ajaxRequest() argument was originally 34 elements in length. To eliminate the problem being down to the length of the array I restricted it to two items, however the problem still occurs.

Please take a look at this for me - I'm running out of ways to isolate the problem.

Many thanks,
Rob
0
Pavlina
Telerik team
answered on 25 Dec 2012, 04:51 PM
Hi Rob,

Can you download latest version of RadControls for ASP.NET AJAX and verify that the same error still persists?

Kind regards,
Pavlina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Ajax
Asked by
Rob
Top achievements
Rank 1
Answers by
Rob
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or