我可以从Kendo Grid绑定列传递我的参数,如下所示。但我的控制器将其视为GET。我无法让控制器将其视为[HTTPPOST]
@(Html.Kendo().Grid((IEnumerable<myApp.Dal.SmKpr1Value>) ViewBag.kk1)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(c => c.opYear).Width(100);
columns.Bound(c => c.opPeriod).Width(100);
columns.Bound(c => c.val).Width(100)
.ClientTemplate(@Html.ActionLink("#=val#", "myAction", "myController", routeValues: null, htmlAttributes: new{ para1 = @ViewBag.para1, para2 = "#=opYear#", para3 = "#=opPeriod#",@class = "postLink k-button", onclick = "myFunction(this)" })
.ToHtmlString());
}
.
.
)
<script>
function myFunction(e) {
var _para1 = $(e).attr("para1");
var _para2 = $(e).attr("para2");
var _para3 = $(e).attr("para3");
var parameters = { param1: _para1, param2: _para2, param3: _para3 };
$.Ajax({
method: 'POST',
url: $(e).attr("href"),
data: parameters,
success: function (success)
{
alert(success);
}
});
}
</script>