在控制器上Put如下:
[HttpPut]
[ActionName("putname")]
public JsonResult putname(string name)
{
var response = ...
return Json(response);
}
Run Code Online (Sandbox Code Playgroud)
问题在于通过以下方式消费此API
using (httpClient = new HttpClient())
{
string name = "abc";
string jsonString = JsonConvert.SerializeObject(name);
var requestUrl = new Uri("http:...../controller/putname/");
using (HttpContent httpContent = new StringContent(jsonString))
{
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
HttpResponseMessage response = httpClient.PutAsync(requestUrl, httpContent).Result;
}
Run Code Online (Sandbox Code Playgroud)
此代码不会将参数名称传递给控制器.我甚至尝试将uri更改为/ putname /"+ name.
我有jqgrid.我根据列值对几行进行了分组.在 定义jqGrid的代码的链接部分提供了工作演示
var preclosingtable = $('#preclosing');
preclosingtable.jqGrid({
datatype: 'local',
data: data.DOCS,
colNames: ['', 'Documents Received', 'Comments', 'NA', 'DocGroup'],
colModel: [
{ name: 'Documents', index: 'Documents', align: 'left', sortable: false, editable: false, width: 20 },
{ name: 'DocsReceived', index: 'DocsReceived', align: 'center', sortable: false, editable: true, edittype: 'checkbox', editoptions: { value: "True:False" }, formatter: "checkbox", width: 140 },
{ name: 'Comments', index: 'Comments', align: 'center', sortable: false, editable: true, edittype: "textarea", editoptions: { rows: "3", cols: "16" }, width: …
Run Code Online (Sandbox Code Playgroud)