Child client hierarchy is not taking current row values in Actionlink

4 posts, 1 answers
  1. Rajah
    Rajah avatar
    2 posts
    Member since:
    Apr 2014

    Posted 12 Apr 2016 Link to this post

    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>

  2. Answer
    Thomas
    Thomas avatar
    5 posts
    Member since:
    Jun 2015

    Posted 13 Apr 2016 in reply to Rajah Link to this post

    this might be related to the escaping response at the bottom of this http://www.telerik.com/forums/accessing-field-in-clientdetailtemplate
  3. Rajah
    Rajah avatar
    2 posts
    Member since:
    Apr 2014

    Posted 13 Apr 2016 in reply to Thomas Link to this post

    Thanks

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

  4. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2211 posts

    Posted 14 Apr 2016 Link to this post

    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
Back to Top