Hi
I am getting this error -
| Name | Value | Type | |
|---|---|---|---|
| ? | $exception | {"The best overloaded method match for 'NimbusAPi.AwbTracking.GetData(string)' has some invalid arguments"} | Microsoft.CSharp.RuntimeBinder.RuntimeBinderException |
dynamic json = JsonConvert.DeserializeObject(response.Content);
GridView1.DataSource = GetData(json);
GridView1.DataBind();
}
private DataTable GetData(string jsondata)
{
string json = jsondata;
rootObject = JsonConvert.DeserializeObject(json);
List orderDetails = new List();
orderDetails.Add(rootObject.data);
DataTable dataTable = ToDataTable(orderDetails);
return dataTable;
}
Below is the response returned
{"status":true,"data":{"id":"16621681","order_id":"29920015","order_number":"890","created":"2022-12-26","edd":"","pickup_date":"","rto_initiate_date":"","delivered_date":"","shipped_date":"","awb_number":"14189990126365","rto_awb":"","courier_id":"3","warehouse_id":"132002","rto_warehouse_id":"132002","status":"cancelled","rto_status":"","shipment_info":"","history":[{"status_code":"PP","location":"CAR\/HUB, Chandigarh, CHANDIGARH","event_time":"2022-12-26 19:37","message":"Pickup Not Done"},{"status_code":"PP","location":"CAR\/HUB, Chandigarh, CHANDIGARH","event_time":"2022-12-26 12:10","message":"Out for Pickup"},{"status_code":"PP","location":"CAR\/HUB, Chandigarh, CHANDIGARH","event_time":"2022-12-26 11:17","message":"Pending"}]}}
Thanks
Amit MohantyPosted Dec 28, 2022, 4:35 AM
Try this
Jignesh KumarPosted Dec 28, 2022, 4:12 AM
Hi Ramco,
You are passing dynamic object to your function GetData which is expecting string type parameter, you need to convert your response to string as below
Ajay SinghPosted Dec 28, 2022, 3:32 AM
Hi Ramco, with above code its not clear the exception. May be you cam check your "OrderDetails" class structure should match with "RootObject" class.
Give a try by changing getData method as below
GridView1.DataSource = GetData(json.toString());