开发者

jqGrid Invalid JSON primitive when trying to use saveRow()

We're using ASP.NET Webforms and jqGrid. I have no problem retrieving data from our webservice to the grid. However, when trying to use saveRow, we get an exception. I'm thinking it's due to invalid json, but using the built in saveRow() I would have guessed that the grid would make it valid json. Using fiddler2 an开发者_如何学JAVAd the call uses "application/json; charset=utf-8"

Calling saveRow:

$("#SupplierSettingTable").jqGrid('saveRow', rowNumber, true, '<%= ResolveClientUrl("~/Services/SupplierSettingService.asmx/SetSupplierSettingItem")%>' );

Here is the exception:

{"Message":"Invalid JSON primitive: AccountGroupName.","StackTrace":" at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializePrimitiveObject()\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.DeserializeInternal(Int32 depth)\r\n at System.Web.Script.Serialization.JavaScriptObjectDeserializer.BasicDeserialize(String input, Int32 depthLimit, JavaScriptSerializer serializer)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit)\r\n at System.Web.Script.Serialization.JavaScriptSerializer.Deserialize[T](String input)\r\n at System.Web.Script.Services.RestHandler.GetRawParamsFromPostRequest(HttpContext context, JavaScriptSerializer serializer)\r\n at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System.ArgumentException"}

Help appreciated...


You should verify that you use

ajaxRowOptions: { contentType: "application/json" }

and

serializeRowData: function (data) { return JSON.stringify(data); }

jqGrid parameters. See this and this answers for details.

If it will not help you should include in your question the exact data which will be send to the server and the response. You will get the information with respect of Fiddler of Firebug.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜