This question is locked. New answers and comments are not allowed.
I am using Q1 beta, but not sure if problem exists in previous release.
This is part of my view:
It gives me this error on render at line 13:
If I change RowAction to this:
then there is no error, but it makes background green for a split second while grid is rendering. After that - just regular colors from row selection.
Am I doing something wrong or RowAction does not work with OnRowSelect with Ajax binding?
This is part of my view:
<% Html.Telerik().Grid<ItemsModel>() .Name("Grid") .RowAction(row => { if (row.DataItem.ItemName== "Item1") { row.HtmlAttributes["style"] = "background:green;"; } }) .DataKeys(keys => keys.Add(k => k.ItemId)) .DataBinding(dataBinding => dataBinding.Ajax() .Select("Items", "Items") .Columns(columns => { columns.Bound(c => c.ItemId).Hidden(true); columns.Bound(c => c.ItemName).Width(90); }) .Pageable() .Selectable() .ClientEvents(events => events.OnRowSelected("onRowSelected")) .Render(); Html.Telerik().ScriptRegistrar() .Scripts(scripts => scripts.AddGroup("CommonScript", group => group.Add("telerik.window.min.js") .Add("telerik.draganddrop.min.js"))) .OnDocumentReady(@" function onRowSelected(e) { var id = e.row.cells[0].innerHTML; detailsWindow = $.telerik.window.create({ name: 'detailsWindow', title: 'Items', modal: true, draggable: true, contentUrl: '/Items/Item/' + id, onClose: function (e) { e.preventDefault(); detailsWindow.data('tWindow').destroy(); } }); detailsWindow.data('tWindow').center().open(); }"); %>Server Error in '/' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 11: .RowAction(row => Line 12: { Line 13: if (row.DataItem.ItemName == "Item1") Line 14: { Line 15: row.HtmlAttributes["style"] = "background:green;";
If I change RowAction to this:
.RowAction(row => { row.HtmlAttributes["style"] = "background:green;"; })Am I doing something wrong or RowAction does not work with OnRowSelect with Ajax binding?