Non-editable column in InLine grid with dynamic items

3 posts, 1 answers
  1. Derek
    Derek avatar
    12 posts
    Member since:
    Jan 2011

    Posted 22 Jan 2015 Link to this post

    The objects that are enumerated in my Kendo MVC Grid are of type dynamic:


    I am using InLine editing.  I am able to specify the editor for each of my fields as described here:

    I won't reiterate the approach that is described above, but in summary it involves adding a UIHint attribute to fields in the model, and then using EditorTemplateName to identify an editor template for the field (and that editor template refers to the field via the Name() method).  This works.

    The problem that I have is that many of my fields need to appear in non-editable columns.  My hope was that I could get the grid to render those fields as is (no editor) by:

    a. Omit the UIHint attribute from model properties that would not be editable
    b. Not specify an EditorTemplateName for non-editable bound columns
    c. Set Editable(false) when defining the model (as below):

    .DataSource(d =>
            .Model(m =>
                 m.Field("Name", typeof(string)).Editable(false);

    However, when I do this the grid fails to load and I see an exception in Fiddler:

    [RuntimeBinderException: 'object' does not contain a definition for 'Name']
       CallSite.Target(Closure , CallSite , Object ) +152
       System.Dynamic.UpdateDelegates.UpdateAndExecute1(CallSite site, T0 arg0) +662
       lambda_method(Closure , Object ) +133
       Kendo.Mvc.UI.Html.GridDataCellBuilder`2.AppendCellContent(IHtmlNode td, Object dataItem) +131
       Kendo.Mvc.UI.Html.GridDataCellBuilderBase.CreateCell(Object dataItem) +230

    I have many fields and most of them wil be non-editable, so I would rather not, for example, create editor templates for each of them that contain disabled controls.

    What is the best way to configure all my non-editable columns in an InLine grid that is bound to dynamic objects?

  2. Answer
    Rosen avatar
    3253 posts

    Posted 26 Jan 2015 Link to this post

    Hi Derek,

    Indeed, you should be able to disable the editing for given field by setting its Editable option to false. However, this, as seems, does not work in the scenario in question as we were able to replicate the error you have described. Fortunately, we manage to address it and the fix will be included in the next internal build. Meanwhile, I have updated your telerik points.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. Derek
    Derek avatar
    12 posts
    Member since:
    Jan 2011

    Posted 06 Feb 2015 in reply to Rosen Link to this post

    Hi Rosen,

    Thank you very much.  I have verified that the problem I described is fixed in internal build 2014.3.1328.545.  I appreciate the prompt and successful resolution.

Back to Top