I have a grid that has an edit and a delete button. I want to hide those buttons conditionally based on a specific value within the row. How can I accomplish this? For reference here is the current Grid create.
01.
@(Html.Kendo()
02.
.Grid<CdEyeColor>()
03.
.Name(
"Codes"
)
04.
.DataSource(ds =>
05.
{
06.
ds.Ajax()
07.
.ServerOperation(
true
)
08.
.Model(m =>
09.
{
10.
m.Id(code => code.EyeColorId);
11.
})
12.
.Create(create => create.Action(
"CreateCode"
,
"CdEyeColor"
))
13.
.Read(read => read.Action(
"ReadCode"
,
"CdEyeColor"
))
14.
.Update(update => update.Action(
"EditCode"
,
"CdEyeColor"
))
15.
.Destroy(destroy => destroy.Action(
"DeleteCode"
,
"CdEyeColor"
));
16.
})
17.
.Columns(columns =>
18.
{
19.
columns.Bound(c => c.EyeColorTitle).Width(100);
20.
columns.Bound(c => c.EyeColorDescription).Width(200);
21.
columns.Bound(c => c.BeginDate).Width(100);
22.
columns.Bound(c => c.EndDate).Width(100);
23.
columns.Bound(c => c.changedByName).Width(150);
24.
columns.Bound(c => c.ChangedTimestamp).Width(200);
25.
columns.Bound(c => c.createdByName).Width(150);
26.
columns.Bound(c => c.CreatedTimestamp).Width(100);
27.
columns.Command(command =>
28.
{
29.
command.Edit().UpdateText(
"Update"
);
30.
command.Destroy();
31.
});
32.
})
33.
.ToolBar(toolbar => toolbar.Create())
34.
.HtmlAttributes(
new
{ style =
"height: 380px;"
})
35.
.Scrollable()
36.
.Groupable()
37.
.Events(x => { x.Edit(
"onEdit"
); x.Save(
"onGridSave"
); })
38.
.Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName(
"EditorTemplateEyeColor"
).Window(window => { window.Title(
"Eye Color"
); }))
39.
.Sortable()
40.
.Pageable(pageable => pageable
41.
.Refresh(
true
)
42.
.PageSizes(
true
)
43.
.ButtonCount(5))
44.
)