Hello,
I am using a grid connected to a wcf service like this:
My Service looks like this:
The wsDocumentDetail object is this:
My update function:
Now, when i click on Save changes i get a 400 bad request and i think this is the line causing all the problems
I tried changing it but when debugging the docLines object remains empty.
Could you please tell me what am i doing wrong.
Thank you.
I am using a grid connected to a wcf service like this:
dataSource: { transport: { read: { url: "http://localhost:52916/Service1.svc/getdocumentdetail/"+e.data.SaleDocId, dataType: "json", type: "GET" }, update: { url: "http://localhost:52916/Service1.svc/updateDocumentDetails", dataType: "json", type: "POST" }, parameterMap: function(data, operation) { if (operation != "read") { // web service method parameters need to be send as JSON. The Create, Update and Destroy methods have a "products" parameter. return JSON.stringify({ docLines: data.models }) } else { return JSON.stringify(data); } } }, schema: { data: "GetDocumentDetailResult", total: "GetDocumentDetailResult.length", model: { id: "SaleDocId", fields: { SaleDocId: { type: "number", editable: false, nullable: true}, Line: { type: "number", editable: false}, Item: {type: "string", editable: false}, Location: { type: "string", editable: false}, Description: {type: "string", editable: false}, Qty: {type: "number", editable: true, validation: { min: 0}}, ItemWeight: { type: "number", editable: true, validation: { min: 0}}, GrossWeight: { type: "number", editable: false} } } },My Service looks like this:
<OperationContract> <WebInvoke(Method:="POST", ResponseFormat:=WebMessageFormat.Json, RequestFormat:=WebMessageFormat.Json, BodyStyle:=WebMessageBodyStyle.Wrapped, UriTemplate:="updateDocumentDetails")> Function UpdateDocumentDetails(ByVal docLines As IEnumerable(Of wsDocumentDetail))The wsDocumentDetail object is this:
<DataContract()> _Public Class wsDocumentDetail Inherits wsDocument Private m_Description As String = String.Empty Private m_Item As String = String.Empty Private m_Line As Integer = 0 Private m_Qty As Integer = 0 Private m_GrossWeight As Double = 0 Private m_ItemWeight As Double = 0 Private m_Location As String = String.Empty Private m_QtaSede As Integer = 0 Private m_Payment As String = String.Empty Private m_Port As String = String.Empty Private m_NoOfPacks As Integer = 0 Private m_Carrier1 As String = String.Empty Private m_ShipToAddress As String = String.Empty Private m_Transport As String = String.Empty.... all the get; set;My update function:
Public Function UpdateDocumentDetails(ByVal docLines As IEnumerable(Of wsDocumentDetail)) Implements IService1.UpdateDocumentDetails'Do stuff hereend functionNow, when i click on Save changes i get a 400 bad request and i think this is the line causing all the problems
return JSON.stringify({ docLines: data.models })I tried changing it but when debugging the docLines object remains empty.
Could you please tell me what am i doing wrong.
Thank you.