This question is locked. New answers and comments are not allowed.
I am trying to create an editable grid bound to a dynamic type, following the instructions in this blog. My page does not render, and I am getting the following error:
System.InvalidOperationException: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
Here is my code:
Everything works fine if I replace dynamic with a real class, or if I keep the grid read-only. I am using the Q1 2011 Telerik extensions (2011.1.315).
I would appreciate any insight that would help me figure out what I am doing wrong!
Thanks,
Helene
System.InvalidOperationException: Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
Here is my code:
@model IEnumerable<dynamic> @{ ViewBag.Title = "Test"; } <div> @(Html.Telerik().Grid(Model) .Name("TestGrid") .DataKeys(keys => keys.Add("Id")) .ToolBar(commands => commands.Insert()) .DataBinding(dataBinding => dataBinding .Ajax() .Select("AjaxIndex", "Test") .Insert("Create", "Test") .Update("Edit", "Test") .Delete("Delete", "Test") ) .Columns(columns => { columns.Bound("Name"); columns.Bound("Description"); columns.Command(commands => { commands.Edit(); commands.Delete(); }).Width(180).Title("Commands"); }) .Editable(editable => editable.Mode(GridEditMode.InLine)) ) </div>Everything works fine if I replace dynamic with a real class, or if I keep the grid read-only. I am using the Q1 2011 Telerik extensions (2011.1.315).
I would appreciate any insight that would help me figure out what I am doing wrong!
Thanks,
Helene