I'm getting a JSON objec开发者_如何学编程t(i.e. NewDataSet) in the POST request, see image below (Firebug-request object)...
How can i get this object at server side ??
Thanks Xtremist
I would create a server side object matching the JSON object you are posting to the server.
public class DataPackage
{
public string CostType {get; set;}
public string CostName {get; set;}
public bool isEditable {get; set;}
...
}
In your webservice you can setup the service definition like this:
[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json, XmlSerializeString = false)]
public void MyWebservice(DataPackage NewDataSet) {
...
}
You need to tell your client side posting script that you are sending json:
contentType: 'application/json'
If I remember correctly this will tell ASP.NET to deserialize your JSON object into the .NET class.
Checkout information on JSON.net
精彩评论