我正在为Asp.net MVC应用程序使用Html.Telerik.Grid(Model)。一些 原因客户端函数OnRowDataBound(“OnRowDataBound”)不是 在以下代码中触发。我把断点放在客户端函数中并没有被击中;然而,onLoad(e)的功能确实受到了打击。请告诉我缺少什么。 谢谢你的时间!!
@(
Html.Telerik().Grid(Model)
.Name("SiteGrid")
.Columns(columns =>
{
columns.Bound(c => c.EMP_NO)
.Title("EMP_NO");
columns.Bound(c => c.EMP_NAME)
.Title("EMP_NAME");
columns.Bound(c => c.HIRED_DATE)
.Title("HIRED_DATE");
})
.Resizable(resize => resize.Columns(true))
.Scrollable(scrolling => scrolling.Height(200))
.Filterable()
.Groupable(grouping => grouping.Enabled(true))
.Sortable()
.Footer(true)
.Reorderable(reorder => reorder.Columns(true))
.ClientEvents(e => e.OnLoad("onLoad").OnRowDataBound("OnRowDataBound"))
)
function OnRowDataBound(e)
{
var myNewDate = new Date();
hiredDate = e.dataItem.HIRED_DATE;
var todayDate = parseDate(myNewDate);
var theHiredDate = parseDate(hiredDate);
var dayDifference = daydiff(parseDate(todayDate), parseDate(theHiredDate));
if(dayDifference > 24){
e.row.style.backgroundColor = "Red";
}
}