1
Help for ParamQuery Grid (free version) / getting data from asp.net page's web method or web service
« on: January 16, 2014, 11:35:00 am »
i tried
dataModel = {
location: "remote",
method: "POST",
getUrl: function () {
var getObj = {
url: "jquerygrid.aspx/GetCustomers",
data: data
};
return getObj;
},
getData: function (dataJSON) {
return { curPage: dataJSON.SelectedPage, totalRecords: dataJSON.TotalRecord, data: dataJSON.data };
}
};
and also this
dataModel: {
beforeSend: function (jqXHR, settings) {
jqXHR.setRequestHeader("Content-Type", "application/json");
}
}
my web method is as follows
[System.Web.Services.WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static string GetCustomers()
{
string query = "SELECT * FROM tr";
SqlCommand cmd = new SqlCommand(query);
DataSet data = GetData(cmd);
string strjson = GetJson(data.Tables[0]);
return strjson;
}
the only difference here is instead of method:"Post" i have method:"Get".Thats it..
Is anything wrong i m doing or missing something.Why am i still not able to call my webmethod
dataModel = {
location: "remote",
method: "POST",
getUrl: function () {
var getObj = {
url: "jquerygrid.aspx/GetCustomers",
data: data
};
return getObj;
},
getData: function (dataJSON) {
return { curPage: dataJSON.SelectedPage, totalRecords: dataJSON.TotalRecord, data: dataJSON.data };
}
};
and also this
dataModel: {
beforeSend: function (jqXHR, settings) {
jqXHR.setRequestHeader("Content-Type", "application/json");
}
}
my web method is as follows
[System.Web.Services.WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Json)]
public static string GetCustomers()
{
string query = "SELECT * FROM tr";
SqlCommand cmd = new SqlCommand(query);
DataSet data = GetData(cmd);
string strjson = GetJson(data.Tables[0]);
return strjson;
}
the only difference here is instead of method:"Post" i have method:"Get".Thats it..
Is anything wrong i m doing or missing something.Why am i still not able to call my webmethod