This is a migrated thread and some comments may be shown as answers.

[Solved] Child Grid data source action never called

9 Answers 339 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mutuhraj
Top achievements
Rank 1
Mutuhraj asked on 30 May 2013, 06:27 PM
Hello,
I am having a grid which will show the driver detail and if the use expands one row then I want to show the some information of that driver in another grid.

Below is my code
 <%: Html.Kendo().Grid<PrimeWebInterface.Views.ViewModels.DriverViewModel>()
                 .Name("DriverRoute")
            .Columns(columns =>
            {
                columns.Bound(e => e.Code);
                columns.Bound(e => e.Name);

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

    <script id="template" type="text/kendo-tmpl">
        <%: Html.Kendo().Grid<PrimeWebInterface.Views.ViewModels.DriverRouteGrid>()
                .Name("DriverRoute_#=Code#")
                .Columns(columns =>
                {
                    columns.Bound(o => o.RouteDate);
                    columns.Bound(o => o.ItinaryCode);
                    columns.Bound(o => o.RouteID);
                })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(5)
                    .Read(read => read.Action("Bind_Itinary", "DriverRoute", new { code ="#=Code#" }))
                )
                .Pageable()
                .Sortable()
                .ToClientTemplate()               
        %>
    </script>
    <script>
        function dataBound() {
            this.expandRow(this.tbody.find("tr.k-master-row").first());
        }
        
    </script>
</asp:Content>

Code (string type) is the primary field. With the above code I can able to see the parent records (Driver) and the child grid not showing any records.


Since I am new to this , I might have missed some setting. So, Could you please guide me to solve this issue.?

Thanks and Best Regards
Muthuraja

9 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 31 May 2013, 07:42 AM
Hello Mutuhraj,

The Grid setup looks correct to me. Do you see any JavaScript errors when the detail Grid gets expanded? When you inspect that browser console `Network` tab are there any failed requests with server errors or something? Is your controller and action method correctly implemented?

Here is an article showing how to implement Grid hierarchy step by step: Client Detail Template

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mutuhraj
Top achievements
Rank 1
answered on 31 May 2013, 08:06 AM
Hello Nikolay ,

Thank you very much for your response. 

I am not seeing any with the Java Script. 

I have attached my files and could you please check it and give your comments.

Thanks and Best Regards,
Muthuraja
0
Nikolay Rusev
Telerik team
answered on 31 May 2013, 02:31 PM
Hello Mutuhraj,

I'm afraid that there aren't any attachments in your post. Could you, please try attaching those files again?

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mutuhraj
Top achievements
Rank 1
answered on 31 May 2013, 06:20 PM
Hello Nikolay ,

Please find the files.

Thanks and Best Regards
Muthuraja
0
Mutuhraj
Top achievements
Rank 1
answered on 31 May 2013, 06:25 PM
Hello Nickoly,
I am not sure why my attachment is failing, I am zipping it and attach it again.

Thanks and Best Regards
Muthuraja
0
Nikolay Rusev
Telerik team
answered on 03 Jun 2013, 07:32 AM
Hello Mutuhraj,

You are missing kendo.aspnetmvc.min.js in your script section:
<script src="../../Content/js/jquery.min.js"></script>
<script src="../../Content/js/kendo.all.min.js" type="text/javascript"> </script>
 
<!-- you must add the following script too -->
<script src="../../Content/js/kendo.aspnetmvc.min.js" type="text/javascript"> </script>

See step 5 from the following article for more details: Using Kendo UI in ASP.NET MVC application

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Mutuhraj
Top achievements
Rank 1
answered on 04 Jun 2013, 03:05 PM
Hello Nikolay ,

I have tried adding .js file still the rows are not getting loaded in to the child grid. The Action I have return for the child grid is never gets called.

Please let me know if you have any idea on this.

Thanks and Best Regards
Muthuraja
0
Nikolay Rusev
Telerik team
answered on 05 Jun 2013, 06:03 AM
Hello Mutuhraj,

If you provide us with a runnable sample that illustrates the behavior we will be able to assist you further.

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Nate
Top achievements
Rank 1
answered on 31 Dec 2014, 09:01 PM
Did you resolve this? I am having the same problem.
Tags
Grid
Asked by
Mutuhraj
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Mutuhraj
Top achievements
Rank 1
Nate
Top achievements
Rank 1
Share this question
or