0
這裏是kendo網格我有<href>
標籤onclick函數()。現在我想傳遞文件名作爲參數到我的onclick函數。我想通過該文件名到CallAjaxMethod函數作爲參數。如何做?如何將參數傳遞給kendo的javascript函數<a href=""></a>
@(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);
}
});
}