Click Here
Hi,

I have a problem , can anybody explain what this code really mean...

.ClientEvents(events => events.OnRowDataBound("orders_onRowDataBound"))
                .DetailView(ordersDetailView => ordersDetailView.ClientTemplate(
                    Html.Telerik().Grid<OrderDetailsViewModel>()
                        .Name("OrderDetails_<#= OrderID #>")
                        .Columns(columns =>
                        {
                            columns.Bound(od => od.ProductName).Width(233);
                            columns.Bound(od => od.Quantity).Width(200);
                            columns.Bound(od => od.UnitPrice).Width(200);
                            columns.Bound(od => od.Discount);
                        })
                        .DataBinding(dataBinding => dataBinding.Ajax()
                                .Select("_OrderDetailsForOrderHierarchyAjax", "Grid", new { orderID = "<#= OrderID
                                    #>" }))
                        .Pageable()
                        .Sortable()
                        .ToHtmlString()
                    ))

I can understand most of the part but the problem comes when I go through this line

.DataBinding(dataBinding => dataBinding.Ajax()
                                    .Select("_OrderDetailsForOrderHierarchyAjax", "Grid", new { orderID = "<#= OrderID
                                        #>" }))

I think _OrderDetailsForOrderHierarchyAjax refers to methode _OrderDetailsForOrderHierarchyAjax(int val) methode in controler and what is

new { orderID = "<#= OrderID #>" }

is that the parameter we passe to methode?

I think problem is clear.

thx in advance..

Member Avatar for LastMitch

I think problem is clear.

What is the issue you are having?

I assume you didn't write this code because if you did you wouldn't post a link of the example and a code.

I think _OrderDetailsForOrderHierarchyAjax refers to methode _OrderDetailsForOrderHierarchyAjax(int val) methode in controler and what is ew { orderID = "<#= OrderID #>" }is that the parameter we passe to methode?

This is the info from the link it explain what you mention very clearly:

This example demonstrates how to use the client detail template in order to achieve three level hierarchy: 

Employees -> Orders -> OrderDetails with ajax binding.

Important notes:

Use the ClientTemplate method to set the client template (used only for ajax and web service binding scenarios).
Make sure the Name of any UI component defined in the template is unique. 

A property of the bound object can be used to ensure such uniqueness by utilizing client binding expressions: 

Name("Orders_<#= EmployeeID #>").

Calling the ToHtmlString method is required in order to output the contents of any UI components defined in the client detail template.

If the master grid is client bound (ajax or web service) so must be the child grids (defined in the client detail template).

Example:

 <%= Html.Telerik().Grid<EmployeeViewModel>()
.Name("Employees")
.DetailView(details => details.ClientTemplate(
        Html.Telerik().Grid<OrderViewModel>()
            .Name("Orders_<#= EmployeeID #>")
            .DetailView(ordersDetailView => ordersDetailView.ClientTemplate(
                Html.Telerik().Grid<OrderDetailsViewModel>()
                    .Name("OrderDetails_<#= OrderID #>")
                    .DataBinding(dataBinding => dataBinding.Ajax()
                        .Select("_OrderDetailsForOrderHierarchyAjax", "Grid", new { orderID = "<#= OrderID #>" }))
                    .Pageable()
                    .Sortable()
                    .ToHtmlString()
             ))
            .DataBinding(dataBinding => dataBinding.Ajax()
                .Select("_OrdersForEmployeeHierarchyAjax", "Grid", new { employeeID = "<#= EmployeeID #>" }))
            .Pageable()
            .Sortable()
            .ToHtmlString()
))
.DataBinding(dataBinding => dataBinding.Ajax().Select("_EmployeesHierarchyAjax", "Grid"))
.Pageable(paging => paging.PageSize(5))
.Scrollable(scrolling => scrolling.Height(580))
%>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.