I have following code in my Razor View. Grid displays link but Onclick event doesn't fire. What should i do to make sure it's wired properly with the event handler
columns.Template(c => c).ClientTemplate("# if (IsVerified == true) { #" +
"<text><a onclick=\"show('#=data#') href='\\#'\">View</a></text>" +
"# } else if(IsVerified == false) { #" +
"<text><a onclick=\"verify('#=data#') href='\\#'\">Verify</a></text>" +
"# } #").Title("Action").Width("50px").HtmlAttributes(new {style = "text-align:center"});
One of the Event handler is as following
function show(e) {
var grid = $("#grid").data("kendoGrid");
var model = grid.dataItem($(event.target).closest("tr"));
}
Please try to change from
var model = grid.dataItem($(event.target).closest("tr"));
to
var model = grid.dataItem($(e.target).closest("tr"));
because pass e not event
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.