Make cell readonly in Kendo Grid if condition is met

Viewed 54516

Let's say I have a data like this:

[
    {ID: 1, SomeForeignKeyID: 4, IsFkEnabled: true},
    {ID: 2, SomeForeignKeyID: 9, IsFkEnabled: false}
]

Kendo Grid is using this data:

columns.Bound(m => m.ID);
columns.ForeignKey(p => p.SomeForeignKeyID, ViewBag.ForeignKeys as IEnumerable<object>, "Value", "Name");

Here's the problem: how to make ForeignKey column editable, but only in rows, where IsFkEnabled == true? Edit mode is InCell.

6 Answers

Use Template column instead of Bound column

columns.Template(@<text></text>).ClientTemplate("#=Id#").Title("Id");
Related