I want to implement a grid where there are some default values and the user can add more. So, on the default rows it should only have an edit button, but on the others it should appear a edit and a delete button. How can I have different buttons for different rows.
This is my .cshtml with the grid, at the moment with an edit and delete button on every row
@(Html.Kendo().Grid<GenericGridDTO>()
.Name(gridName)
.Columns(columns =>
{
switch (Model.ControlType)
{
case ControlTypeEnum.OneRow:
columns.Bound(m => m.Specification);
break;
case ControlTypeEnum.TwoRow:
columns.Bound(m => m.Parameter);
columns.Bound(m => m.Specification);
break;
}
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(AppConstants.gridActionsWidth);
})
.ToolBar(toolbar => toolbar.Create())
.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.Sort(sort => sort.Add("Order").Ascending())
.Model(model =>
{
model.Id(p => p.Id);
model.Field(f => f.ParentId).DefaultValue(Model.ParentId);
model.Field(f => f.TableId).DefaultValue(Model.TableId);
model.Field(f => f.Order).DefaultValue(Model.DataSource.OrderBy(d => d.Order).LastOrDefault().Order + 1);
model.Field(f => f.ParentTable).DefaultValue(Model.ParentTable);
})
.Create(update => update.Action("CreateGeneric", "Generic"))
.Update(update => update.Action("EditGeneric", "Generic"))
.Destroy(update => update.Action("DeleteGeneric", "Generic"))
)
.BindTo(Model.DataSource)
)
At GenericGridDTO.cs I have this
//Id of default parameter, null if manually added
public int? DefaultParameterId { get; set; }