这是我用 onclick 函数()标记的剑道网格<href>
。现在我想将文件名作为参数传递给我的 onclick 函数。我想将该文件名作为参数传递给 CallAjaxMethod 函数。怎么办?
@(Html.Kendo().Grid<MVCAPPModels..AttachmentsModel>()
.Name("grid")
.Columns(columns =>
{
columns.Bound(p => p.FileName).ClientTemplate("<a id='FileName' href='\\#' data-pdfurl='#= FileName #' onclick='CallAjaxMethod('#= FileName #');'>/#= FileName #</a>");
columns.Bound(c => c.CreatedDate).Width(70);
columns.Bound(c => c.CreatedBy).Width(70);
columns.Bound(c => c.UpdatedDate).Width(70);
columns.Bound(c => c.UpdatedbBy).Width(70);
})
.HtmlAttributes(new { style = "height: 350px;" })
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(1))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Read(read => read.Action("Customers_Read", "Home"))
)
)
JavaScript 函数:
function CallAjaxMethod()
{
alert("page! CallAjax");
$.ajax({
type: "POST",
url: "@Url.Action("Submit", "Home")",
data: { fileName: "/pdfSample.pdf" },
type: 'GET',
cache: false,
success: function (result) {
$('#partialView_div').data(result);
}
});
}