jqGrid
$(document).ready(function () {
$("#grid").jqGrid({
url: '@Url.Action("GetAllAuthors", "Admin")',
datatype: "json",
mtype: 'get',
colNames: ['Yazar Adı', 'Öz Geçmiş'],
colModel: [
{ name: 'Name', index: 'Name', editable: false },
{ name: 'Description', index: 'Description', editable: false }
],
jsonReader: {
repeatitems: false,
id: "sno",
root: "rows", //array containing actual data
page: "page", //current page
total: "total", //total pages for the query
records: "records", //total number of records
repeatitems: false
},
rowNum: 10,
rowList: [10, 20, 30, 40, 50],
pager: jQuery('#gridpager'),
sortname: 'Name',
viewrecords: true,
sortorder: "asc",
width: 710,
height: 300
})
.navGrid('#gridpager', { edit: false, add: false, del: false, search: false, refresh: false })
.navButtonAdd('#gridpager', {
caption: "Düzenle",
buttonicon: "ui-icon-pencil",
onClickButton: function () {
var grid = $("#grid");
var rowid = grid.jqGrid('getGridParam', 'selrow');
//alert(rowid + " - " + grid.jqGrid('getCell', rowid, 'CustomerName') + " - Link: " + $("#customers_grid_table a.customer_details").attr("href"));
window.location = '@Url.Action("EditAuthor", "Admin")?authorId=' + rowid;
//LoadAction('@Url.Action("EditAuthor", "Admin")?authorId=' + rowid);
}
}); //end jqgrid
});
我的控制器中有两种方法
获取方法
[HttpGet]
public ActionResult EditAuthor(int authorId)
发布方法
[HttpPost]
public ActionResult EditAuthor(AuthorViewModel model, HttpPostedFileBase file)
我选择了一行并单击了编辑按钮,我希望触发 get 方法,但触发了 post 方法。我该怎么做才能触发 get 方法?
谢谢。