I have an ASP.NET PageMethod with the following signature:
<WebMethod()> _
Public Shared Function SaveCodes(ByVal codes As List(Of Code)) As String
I am trying to pass a JSON object to the PageMethod from the client side, but I get an error that the type String cannot be converted to type of List<Code>
.
Here is the json that I'm building on the client and sending to the method:
{
'codes' : {
{ "companyID": "00000000-0000-0000-0000-000000000000", "customerType":"1", "code":"11 " },
{ "companyID": "00000000-0000-0000-0000-000000000000", "customerType":"1", "code":"21 " }
}
}
Here is my PageMethod call, (objects is the json string about):
PageMethods.SaveCodes(objects, successFn, errorFn);
I have been able to pass in simple data types and a single instance of the Code class, but I can't seem to find the magin to pass a List to the server method. Can anyone show me what I'm doing wrong?