0

I am using jqgrid to retrieve data from api controller post method. I have set the jquery url,datatype and mtype like below.

url: ..api/ControllerName,
datatype: "json",
mtype: 'POST',

Problem 1: But it is not hitting the controller.
Problem 2: I also want to sent some validation data with this url to preform some validation then allow data retrieval to user.

ozil
  • 6,930
  • 9
  • 33
  • 56

2 Answers2

0

I would recommend you to use Developer Tools of Chrome/Internet Explorer/Firefox (see Network part) or the tool like Fiddler available for free to trace HTTP traffic and to verify whether the POST request will be do sent to the server.

Depend on what API controller you use it can be that the method will be not called by the framework because not all input parameters can be initialized by the request. Typically the framework used by API controller on the lower level will return an error back to jgGrid. You can see the response in the HTTP traffic. I recommend you to use loadError callback of jqGrid to display an error message in such case. See the answer for more details.

To send additional parameters to the server you can use postData parameter of jqGrid. I recommend you to read the answer for more details.

By the way some standard parameters will be sent by jqGrid to the server. You can use prmNames option of jqGrid to rename the standard parameters or to remove some from there (by usage null as the value of the corresponding prmNames property).

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
0

I found some help jqGrid With ASP.NET Web API

ozil
  • 6,930
  • 9
  • 33
  • 56