Search code examples
asp.net-mvckendo-gridkendo-asp.net-mvckendo-tabstrip

Kendo MVC Grid inside Kendo TabStrip


I have Kendo Tabstrip control place in a partial view and inside that tabstrip I have Kendo Grid.

         @(Html.Kendo().TabStrip()
                .Name("tabstrip1")
                .Items(ts =>
                        {
                        ts.Add()
                        .Text("Tab Strip 1")
                        .Content(@<text>
                            @(Html.Kendo().Grid<testproject.Class.DiscussionBoard>()
                                .Name("kendogrid1")
                                .Columns(columns =>
                                    {
                                        columns.Bound(p => p.Name).Title("Name");
                                        columns.Bound(p => p.CreatedBy).Title("Created By");
                                        columns.Bound(p => p.Subject).Title("Subject");
                                        columns.Bound(p => p.CommentsDescription).Title("Comments/Description");
                                        columns.Bound(p => p.ModifiedOn).Title("Modified On ");
                                    })
                        .NoRecords("No Recod Exists!!")
                            )
                        </text>);
                        })
        )

When I run this I get this error Error When Kendo MVC Grid is used inside kendo TabStrip

I tried searching over the net but didn't find much about this problem

ASP MVC 5 Project

Help is always appreciated

Thanks


Solution

  • use GridBuilder.ToHtmlString():

    .Content(Html.Kendo().Grid<testproject.Class.DiscussionBoard>()
        .Name("kendogrid1")
        .Columns(columns =>
        {
            columns.Bound(p => p.Name).Title("Name");
            columns.Bound(p => p.CreatedBy).Title("Created By");
            columns.Bound(p => p.Subject).Title("Subject");
            columns.Bound(p => p.CommentsDescription).Title("Comments/Description");
            columns.Bound(p => p.ModifiedOn).Title("Modified On ");
        })
        .NoRecords("No Recod Exists!!")
        .ToHtmlString()
    )