This is a migrated thread and some comments may be shown as answers.
Editable grid and dynamic type in MVC3/Razor
1 Answer 72 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Helene Lach
Top achievements
Rank 1
Helene Lach asked on 30 Mar 2011, 02:31 AM
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:

@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

1 Answer, 1 is accepted

Sort by
0
pawan
Top achievements
Rank 1
answered on 13 Jan 2012, 09:15 AM
I am getting the same error
please help me

I am using the popup edit mode
but popup is not showing any content, its showing the empty window with two button update and cancle only
Tags
Grid
Asked by
Helene Lach
Top achievements
Rank 1
Answers by
pawan
Top achievements
Rank 1
Share this question
or