This is a migrated thread and some comments may be shown as answers.

Disable certain column while editing / creating new.

0 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Karol
Top achievements
Rank 1
Karol asked on 20 Nov 2012, 11:39 AM
Hi I want to disable certain columns while editing Columns (addDate and ModifiedDate). I was searching something like Telerik isEditable(false) but I cant find it. Here is code of my grid:
@(Html.Kendo().Grid(Model)
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Title);
        columns.Bound(p => p.Author);
        columns.Bound(p => p.BookGenreId);
        columns.Bound(p => p.ReleaseDate);
        columns.Bound(p => p.ISBN);
        columns.Bound(p => p.Count);
        columns.Bound(p => p.AddDate);
        columns.Bound(p => p.ModifiedDate);
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()  
    .DataSource(dataSource => dataSource
                .Server()
        // Specify that the ProductID property is the unique identifier of the model
                .Model(model => model.Id(p => p.BookId))
                    .Create(create => create.Action("Create", "Books"))
                    .Read(read => read.Action("Index", "Books"))
                    .Update(update => update.Action("Update", "Books"))
                    .Destroy(destroy => destroy.Action("Destroy", "Books"))
     )
)

Resolved by 

                .Model(model =>
                {
                    //The unique identifier (primary key) of the model is the ProductID property
                    model.Id(p => p.BookId);


                    model.Field(p => p.ModifiedDate).Editable(false);
                    model.Field(p => p.AddDate).Editable(false);
                })

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Karol
Top achievements
Rank 1
Share this question
or