Design time error in cshtml: Cannot convert lambda expression to type 'string' because it is not a delegate type

3 posts, 0 answers
  1. Kevin
    Kevin avatar
    30 posts
    Member since:
    Jul 2012

    Posted 08 Aug 2012 Link to this post

    I am getting no intellisense and design time errors when using the Bound method to declare columns.  When I run the site it works fine, but isn't the whole point of using the lambda instead of magic strings so I can get accurate design time errors?

    In the following code, I get design time errors for each of the lambdas in the columns.Bound declarations.  Am I doing something wrong?

    @(Html.Kendo().Grid<KBMaxLive.Domain.KBUser>()
        .Name("grid")
        .Columns(columns => {
            columns.Bound(u => u.Email).ClientTemplate("<a>#: Email #</a>");
            columns.Bound(u => u.IDUserRole);
            columns.Bound(u => u.FirstName);
            columns.Bound(u => u.LastName);
            columns.Bound(u => u.IsOnLine);
        })
        .Pageable(paging => paging.Enabled(true).PageSizes(new int[]{5, 10, 20, 50}))
        .Sortable()
        .Filterable()
        .Groupable()
        .Selectable(select => select.Type(GridSelectionType.Row).Mode(GridSelectionMode.Multiple))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Users_Read""Users"))
            .PageSize(20))
        
      )  
  2. Dimo
    Admin
    Dimo avatar
    8330 posts

    Posted 13 Aug 2012 Link to this post

    Hello Kevin,

    The provided code snippet works correctly on my side. Feel free to send a standalone project for inspection after checking whether there is some problem not related to the Grid.

    Regards,
    Dimo
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Ravi
    Ravi avatar
    17 posts
    Member since:
    Oct 2012

    Posted 16 Oct 2012 Link to this post

    Hello,

    I am also facing the similar error please suggest me. find my code below

    @{Html.Kendo().Grid(Model)

            .Name("GridSam")
            .DataSource(dataSource => dataSource
                .Server()
                         .PageSize(20)
                .Model(model => model.Id(p => p.ProductID))
                    )

            .Columns(c =>
            {
                c.AutoGenerate(column =>
                {
                    //customize autogenereted column's settings                                                   
                    column.Width = "150px";
                    column.Bound(p => p.ProductID).Groupable(false);
                    column.Bound(p => p.ProductID);

                });
            })

              .Resizable(resizing => resizing.Columns(true))
              .Scrollable(scrolling => scrolling.Enabled(true).Height(600))
              .Sortable(sorting => sorting.Enabled(true))
              .Groupable(grouping => grouping.Enabled(true))
              .Filterable(filtering => filtering.Enabled(true))
              .Reorderable(reorder => reorder.Columns(true))
              .Pageable(Pageable => Pageable.Enabled(true).PreviousNext(true).Input(true).PageSizes(true))
              .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
              .Render();
                    }

    Regards,
    Ravi

     

     

     

Back to Top