views:

771

answers:

1

I am using .Net Ajax PageMethods. I was hoping I could pass a javascript array into my method but I am getting the error: "Type 'System.Array' is not supported for deserialization of an array". Here is a simplified version of what I am doing:

Client Side Code:

function AddItemsToBatch()
{
var stuff = new Array();
stuff[0] = "one thing";
stuff[1] = "some other thing";
PageMethods.AddToBatch(stuff,OnSuccess,OnFail);
}

Server Side Code:

<Web.Services.WebMethod()> Public Shared Function AddToBatch(ByVal stuff as Array) as Boolean
  Return True
End Function
+2  A: 

Try using a collection like an array of strings or objects. IIRC, System.Array is abstract.

Randolpho
That was it, changed to array of strings and that worked - should have realized. Thanks!
brendan

related questions