Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,
I am trying to build a nested grid inside kendo grid using mvc..

For this i am using Two list load action bcs two grid need to load..

Problem here is,
second load action which means inner grid load action is not called..
pls hel pme to solve this issue...\\


this is my view page:

XML
@(Html.Kendo().Grid<ParentModel>()
            .Name("grd")
        .Columns(columns =>
        {
            columns.Bound(e => e.FirstName).Width(110);
         

        })
        .Sortable()
        .Pageable()
        .Scrollable()
        .ClientDetailTemplateId("template")
        .HtmlAttributes(new { style = "height:430px;" })
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(6)
                    .Read(read => read.Action("SampleAction", "ControllerName").Data("passSampleId"))
        )
            .ClientDetailTemplateId("template")
            .Events(events => events.DataBound("dataBound"))
)

<script id="template" type="text/html">
    <div>
        @(Html.Kendo().Grid<ChildModel>()
                            .Name("grd")
            .Columns(columns =>
            {
                columns.Bound(o => o.Sample).Width(70);
                columns.Bound(o => o.Sample).Width(110);
             
                columns.Command(o => o.Edit().Text("Reschedule")).Title("Commands");
                columns.Command(o => o.Edit().Text("Confirm")).Title("Commands");
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model => model.Id(c => c.SampleId))
                .PageSize(10)
                   .Read(read => read.Action("LoadReadAction", "ControllerName", new { SampleId= "1" }))
                                   .Update(Update => Update.Action("LoadEditAction", "ControllerName", new { SampleId= "1" }))
                                           .Update(Update => Update.Action("LoadEditAction", "ControllerName", new { SampleId= "1" }))
            )
            .Pageable()
            .Sortable()
            .ToClientTemplate()
        )
    </div>
    </script>
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>
Posted

1 solution

The "Name" property of both the grids are same. This should be unique as "Name" becomes the id of the grid and ids are unique by nature.
Also, Instead of passing the "SampleId" directly in the .Action method use ".Data" property to pass additional data to Action Method as you have done in Outer grid.

Hope this helps!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900