Hello
I have a situation where I have a number of columns that are supposed to be read only for editing. However, I would like for the user to be able to enter in values for those columns when creating a new record.
Is this possible with Grid?
I have something like
@(Html.Kendo().Grid<View_Model>()
.Name("RecordGrid")
.Columns(column =>
{
columns.Bound(o => o.model_id).Hidden();
columns.Bound(o => o.supplier_id).Title("Supplier ID").Width(150)
//...about 20 more columns
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200).Locked();
}
.ToolBar(toolbar => toolbar.create())
.Editable(editable =>
{
editable.Mode(GridEditMode.Inline)
.ConfirmDelete(Constants.CONFIRM_REC_DELETE);
})
//... etc
.DataSouce(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(o => o.model_id);
model.Field(o => o.supplier_id); //.Editable(false);
//and then just the remaining model fields and the create/read/etc functions
supplier_id (and a few others) I'd prefer to have as read_only (especially being a foreign key) but I need it available for create as ideally I'd have the user pick a supplier and under the hood it gives me the supplier_id foreign key.
I'd like to know if this is possible, because I have about 4-5 fields (and supplier_id is the only FK among them) that should be readonly for edit, but not for create.