How to specify only some Fields as Editable in Grid Edit PopUp.

4 posts, 0 answers
  1. Greg Gum
    Greg Gum avatar
    18 posts
    Member since:
    Jun 2009

    Posted 17 Dec 2013 Link to this post

    I have a Kendo Grid with pop-up editing. 

    How do I specify that only some of the columns are editable?  Or that some are read-only?

    I have tried this in the viewmodel, but it doesn't seem to affect the Edit Popup:

    The Display annotation does work however.
              [Display(Name = "Type Id")]
           public int ReportTypeId { get; set; }

  2. Alexander Popov
    Alexander Popov avatar
    1444 posts

    Posted 19 Dec 2013 Link to this post

    Hi Greg,

    Which columns are editable can be specified in the Grid's DataSource configuration using the editable option in the schema model. For example:  
    .DataSource(dataSource => dataSource
        .Model(model => {
            model.Id(p => p.ProductID);
            model.Field(p => p.ProductName).Editable(false);

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. John
    John avatar
    1 posts
    Member since:
    Mar 2017

    Posted 24 Mar 2017 in reply to Alexander Popov Link to this post

    Hi Alexander

    i am trying to do the same thing with .net core version and is not working....

    Do i have to use template?


    this is my Index.cshtml

            .Columns(columns =>
                columns.Bound(c => c.ID);
                columns.Bound(c => c.CategoryName);
                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(200);
            .ToolBar(toolbar =>
                toolbar.Create().Text("New Category");
            .Editable(editable => editable.Mode(GridEditMode.PopUp))
            .DataSource(dataSource => dataSource
                .Model(model =>
                    model.Id(p => p.ID);
                    model.Field(p => p.ID).Editable(false);
                    model.Field(p => p.CategoryName).Editable(true);
                    model.Field(p => p.UserID).DefaultValue(1).Editable(false);

                .Read(read => read.Action("GetCategories", "Categories"))
                .Create(create => create.Action("Create", "Categories"))
                .Update(update => update.Action("Edit", "Categories"))
                .Destroy(update => update.Action("Delete", "Categories"))

  4. Stefan
    Stefan avatar
    3008 posts

    Posted 28 Mar 2017 Link to this post

    Hello John,

    I was not able to reproduce the same issue on my end. Still, I will make an additional investigation to ensure that the Core version is not causing unexpected issues.

    I can suggest checking the following example how to make a column editable based on a condition. If the column has to be non-editable all of the time, the function can return false in all scenarios:

    I hope this will help to achieve the desired result.

    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top