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

Kendo MVC Grid / Details Grid - child grid's controller not getting called

2 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 22 Jun 2016, 09:47 PM
Does Id have to be an integer or it can be string?
It seems like in my case #=INVOICE# is getting value but it Read method to controller not sure why not getting called.

I tried looking at this example: http://demos.telerik.com/kendo-ui/grid/detailtemplate

    code:
    @(Html.Kendo().Grid<OpenInvoicesInfo>()
                  .Name("grid")
      .Columns(columns =>
      {
          columns.Bound(p => p.INVOICE).ClientTemplate("<input type='checkbox' value='#= INVOICE #' class='testclass' />").Width(4);
          columns.Bound(i => i.INVOICE).Width(15);
          ...     
      })
          .ClientDetailTemplateId("OrdersTemplate")
      .DataSource(dataSource => dataSource
          .Ajax()
          .PageSize(8)
          .Read(read => read.Action("GetOpenInvoices", "Maint", new { cust = Request.QueryString["cust"] }))
      )

    )

    <script id="OrdersTemplate" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<CustomerComments>()
                                .Name("grid_#=INVOICE#")
                .Columns(columns =>
                {
                    columns.Bound(o => o.INVOICE).Width(15);
                    columns.Bound(o => o.Comment).Width(40);
                })
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(10)
                    .Read(read => read.Action("GetCustomerComments", "Maint", new { invoices = "#=INVOICE#" }))
                )
                .Pageable()
                .Sortable()
                .ToClientTemplate()
    )
</script>
          
        Controller:
        public ActionResult GetCustomerComments([DataSourceRequest] DataSourceRequest request, string invoices)
        {

            List<JNI.Enterprise.Contracts.CustomerComments> customer = InvoiceService.GetCustomerComments(invoices);

            return Json(customer.ToDataSourceResult(request));
        }

I will really appreciate if someone can reply.
Does it only work if it is in entity framework.
I am calling GetCustomerComments from a stored procedure.
It is loading the first grid fine but not calling details grid's controller method.

2 Answers, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 27 Jun 2016, 06:57 AM
Hello Gaurav,

You can use whatever primitive you need for the details template. On my end the read method is called with both string and int ID in the overload of the action controller (respectively, in the modal too).

Are there any JS errors in the console? Does the request is at least sent (i.e., appears in the NET tab of the browser's dev toolbar)? It is possible to be called but for some reason not accessible (e.g., server-side error). 

Regards,
Ianko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Gaurav
Top achievements
Rank 1
answered on 27 Jun 2016, 05:00 PM
It is working. Thank you for your help.
Tags
Grid
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Gaurav
Top achievements
Rank 1
Share this question
or