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

Child client hierarchy is not taking current row values in Actionlink

3 Answers 79 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rajah
Top achievements
Rank 1
Rajah asked on 13 Apr 2016, 04:59 AM

Hi 

I tried to use client hierarchy method, first level 'Region Level' and second level "state level". while click region level state level grid bind is happening, but state level details row values are not taken while create client template. why?. please see the code below and let me know where is the problem.

for example child details are 

state   Total Request   Req_sent yes    Red_send No   +ive%  -ive%     Request Sent progress bar

AL           18                      11                       7                    20      80        ActionLink1(20% green) Value 11 | ActionLink2(80% red) Value 7

But only parent grid values are taken. please see the below code and point me where is the problem? how to create action link with progress bar style.

@(Html.Kendo().Grid<VAMDEScheduler.Models.RegionModel>()
            .Name("Regiongrid")
            .Columns(columns =>
            {
                columns.Bound(r => r.Region).Width(200);
                columns.Bound(r => r.TotalRequest).Width(100);
                columns.Bound(r => r.ReqSend_Yes).Width(50);
                columns.Bound(r => r.ReqSend_No).Width(50);
                columns.Bound(r => r.ReqSend_YesP).Width(50).Title("+ive %");
                columns.Bound(r => r.ReqSend_NoP).Width(50).Title("-ive %");
                columns.Template(@<text></text>).ClientTemplate("<div class='progress' style='height:25px'><a href='/sample1?Category=REQUESTSENT_YES&Region=#=Region#' class='progress-bar progress-bar-success' style='width:#=ReqSend_YesP#%;'><span>#=ReqSend_Yes#</span></a><a href='/sample1?Category=REQUESTSENT_NO&Region=#=Region#' class='progress-bar progress-bar-danger' style='width:#=ReqSend_NoP#%;'><span>#=ReqSend_No#</span></a></div>").Title("Request Sent").Width(100);

            }) //columns
                            .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action("Region_Read", "Home")))
                            .ClientDetailTemplateId("State_Read_template")
            )

 

<script id="State_Read_template" type="text/x-kendo-template">
                @(Html.Kendo().Grid<VAMDEScheduler.Models.StateModel>()
                .Name("stategrid") // make sure the Name is unuque
                .Columns(columns =>
                    {
                        columns.Bound(r => r.State).Width(195);
                        columns.Bound(r => r.TotalRequest).Width(100);
                        columns.Bound(r => r.ReqSend_Yes).Width(50);
                        columns.Bound(r => r.ReqSend_No).Width(50);
                        columns.Bound(r => r.ReqSend_YesP).Width(50).Title("+ive %");
                        columns.Bound(r => r.ReqSend_NoP).Width(50).Title("-ive %");
                        columns.Template(@<text></text>).ClientTemplate("<div class='progress' style='height:25px'><a href='/sample1?Category=REQUESTSENT_YES&State=#=Region#' class='progress-bar progress-bar-success' style='width:#=ReqSend_YesP#%;'><span>#=ReqSend_Yes#</span></a><a href='/sample2/#=ReqSend_No#' class='progress-bar progress-bar-danger' style='width:#=ReqSend_NoP#%;'><span>#=ReqSend_No#</span></a></div>").Title("Request Sent").Width(100);
                   
                })
                            .DataSource(dataSource =>
                                // Make request to Products_Read and provide the current CategoryID as a route parameter
                                  dataSource.Ajax().Read(read => read.Action("State_Read", "Home", new { region = "#=Region#" }))
                                )
                            .Pageable()
                            .ToClientTemplate()
                )
            </script>

3 Answers, 1 is accepted

Sort by
0
Accepted
Thomas
Top achievements
Rank 1
answered on 13 Apr 2016, 04:20 PM
this might be related to the escaping response at the bottom of this http://www.telerik.com/forums/accessing-field-in-clientdetailtemplate
0
Rajah
Top achievements
Rank 1
answered on 14 Apr 2016, 01:09 AM

Thanks

Instead of #=ReqSend_YesP#% replace like this \\#=ReqSend_YesP\\#%;

0
Dimiter Madjarov
Telerik team
answered on 14 Apr 2016, 02:02 PM

Hello Rajah,

The information is correct, child properties should be escaped in the detail template.

Regards,
Dimiter Madjarov
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
Tags
Grid
Asked by
Rajah
Top achievements
Rank 1
Answers by
Thomas
Top achievements
Rank 1
Rajah
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Share this question
or