How do I cause the MVC Grid to support insert only and no other operation. This is my code
@(Html.Kendo().Grid<
SomeViewModel
>()
.Name("SomeGrid")
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Columns(columns =>
{
columns.Bound(p => p.Name).ClientTemplate(@"<
input
type
=
'radio'
name
=
'SomeName'
> #= Name # </
input
>");
columns.Bound(p => p.DateCreated);
columns.Command(command => { command.Edit(); });
})
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Events(e => e.DataBound("onDataBound"))
.Selectable(selectable => selectable.Enabled(true).Mode(GridSelectionMode.Single).Type(GridSelectionType.Row))
.Scrollable()
.Filterable()
.HtmlAttributes(new { style = "height:200px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.Events(events => events.Error("onError"))
.Model(model =>
{
model.Id(s => s.unique);
model.Field(s => s.DateCreated).Editable(false);
})
.Read(read => read.Action("GetSolutions", "Solutions"))
.Create(create => create.Action("SomeAction", "SomeController"))
.Update(create => create.Action("SomeAction", "SomeController"))
))
Also, it looks like I have to implement the .Update method above even though I don't want to support updates. If I don't do that I get error "The update data binding setting is required by edit command".
Ideally, it would have been nice to keep the update completely disassociated with inserting but looks like that's not the case and may be there has to be some hack to cause edit not to happen. Can someone please let me know this hack ?