Yes, I did post the whole response.
Also, I tried to edit my code to get the same response format of the example "Paging_and_Sorting/JSON_WebService" . I mean:
Web Service
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string getSalesHeaderList(string customerNo, int start, int limit, string sort, string gridfilters)
{
string strConn = System.Configuration.ConfigurationManager.ConnectionStrings["SQL_SCAMBIO_ConnectionString"].ConnectionString;
DataTable dt = new DataTable();
using (SqlConnection myConnection = new SqlConnection(strConn))
{
myConnection.Open();
using (SqlCommand myCommand = new SqlCommand("SP_B2B_GetOrderList", myConnection))
{
myCommand.CommandType = System.Data.CommandType.StoredProcedure;
myCommand.Parameters.Add(new SqlParameter("Start", start + 1));
myCommand.Parameters.Add(new SqlParameter("Limit", limit));
myCommand.Parameters.Add(new SqlParameter("GridFilters", DBNull.Value));
myCommand.Parameters.Add(new SqlParameter("CustomerNo", HttpContext.Current.Profile["CustomerCode"]));
using (SqlDataAdapter myAdapter = new SqlDataAdapter(myCommand))
{
myAdapter.Fill(dt);
}
}
}
// return string.Format("{{'data':{0}}}", JSON.Serialize(dt));
//string JSONString = string.Format("{{\"d\":{{\"Data\":{0},\"TotalRecords\":{1}}}}}", JSON.Serialize(dt), 100);
//return JSONString;
StoreResponseData storeResponse = new StoreResponseData();
storeResponse.Data = JSON.Serialize(dt);
storeResponse.Total = 100;
//string JSONString = storeResponse.ToString();
string JSONString = string.Format("{{\"d\":{{\"Data\":{0},\"TotalRecords\":{1}}}}}", storeResponse.Data, storeResponse.Total);
return JSONString;
}
Then I modified the .aspx as follows
.aspx
<ext:JsonReader Root="d.Data" TotalProperty="d.TotalRecords" />
this way I got the following response:
{"d":{"Data":[{"Riga":1,"DataOrdine":"2012-03-02T00:00:00","Stato":"Confermato","NrOrdine":8876,"CodiceCliente":"00004","Name":"SAUFLON PHARMACEUTICALS ++++++","Importo":321.71},{"Riga":2,"DataOrdine":"2012-03-02T00:00:00","Stato":"Confermato","NrOrdine":8874,"CodiceCliente":"00004","Name":"SAUFLON PHARMACEUTICALS ++++++","Importo":54.38},{"Riga":3,"DataOrdine":"2012-03-02T00:00:00","Stato":"Confermato","NrOrdine":8873,"CodiceCliente":"00004","Name":"SAUFLON PHARMACEUTICALS ++++++","Importo":29.63},{"Riga":4,"DataOrdine":"2012-03-02T00:00:00","Stato":"Confermato","NrOrdine":8871,"CodiceCliente":"00004","Name":"SAUFLON PHARMACEUTICALS ++++++","Importo":18.19},{"Riga":5,"DataOrdine":"2012-03-02T00:00:00","Stato":"Confermato","NrOrdine":8869,"CodiceCliente":"00004","Name":"SAUFLON PHARMACEUTICALS ++++++","Importo":52.30}],"TotalRecords":100}}
But still no record is displayed in the grid.
Db SQL_SCAMBIO_ConnectionString ha tables linked to other dbs so it is a little unconmfortable to send.
M