![](/img/trans.png)
[英]ASP.NET MVC: issue filtering kendoGrid with kendoDatePicker
[英]Function parameter is not defined onclick in KendoGrid, ASP.NET MVC
如果有人可以就我的問題提供建議,我將不勝感激。
在我的.cshtml
視圖中,我有:
<a class="k-button accountSearch"></a>
<div class="accountsWindow" hidden="hidden">
<div class="accountsGrid">
@Html.Partial("AccountsGrid", context.CustomerAccounts)
</div>
</div>
<script>
function getCustomerAccount(iban) {
alert(iban);
};
</script>
單擊帶有類k-button accountSearch
的以上鏈接時,將出現KendoWindow
:
$(document).ready(function () {
var accwindow = $(".accountsWindow");
acc = $(".accountSearch")
.on("click", function () {
accwindow.data("kendoWindow").open();
});
if (!accwindow.data("kendoWindow")) {
accwindow.kendoWindow({
actions: [
...
]
});
}
});
網格呈現為部分( AccountsGrid.cshtml
),並出現在彈出的kendoWindow
:
@model IEnumerable<DAL.Model.CustomerAccount>
@(Html.Kendo().Grid(Model)
.Name("AccountsGrid")
.Columns(columns =>
{
columns.Bound(u => u.IBAN).Template(@<text> <a onclick="getCustomerAccount(@item.IBAN)">@item.IBAN</a> </text>).Title("IBAN").HtmlAttributes(new { style = "width:150px" });
})
.Pageable()
)
我想通過函數getCustomerAccount(@item.IBAN)
傳遞模型值@item.IBAN
。 調用函數時發生錯誤,它說:
US11223344 is not defined
其中US11223344
是@item.IBAN
值,並且正確,但是為什么會出現錯誤? 我也沒有看到警報。
IBAN是一個字符串值,因此您必須添加''
<a onclick="getCustomerAccount('@item.IBAN')">@item.IBAN</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.