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

Template to ClientTemplate conversion

2 Answers 284 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Romel
Top achievements
Rank 1
Romel asked on 07 May 2014, 05:50 PM

Hi again all. How can this be converted to a ClientTemplate inside a Kendo Grid?

columns.Bound(document => document.Revisions).Template(@<text>
                @if (item.Revisions.Count <= 1)
                {
                    <div>
                        &nbsp;
                    </div>
                }
                else
                {
                    @Html.Raw(string.Format("<text><a id='img' class='icon' href=\"{1}\"><img src=\"{0}\" alt='' style='border:none;' /></a></text>", Url.Content("~/Images/docrev1.png"), Url.Action("ViewRev", "ViewRevisions", new { id = item.OriginalQRCodeID })));
                }

            </text>).Title("").Width(25);


My problem right now is that "Revisions" is an IEnumerable<T> type bound from the server. How do I get its count from client side? Is this even possible? Thanks very much for all the help and I look forward to the response(s).

Romel

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 09 May 2014, 11:59 AM
Hello Romel,

If Revisions is part of the grid model like it seems from the code that you provided then it will still be serialized and will be available in the ClientTemplate data e.g.
columns.Bound(document => document.Revisions)
    .ClientTemplate(
        "#if (Revisions.length <= 1) {#" +
            ...
        "# } else {#" +
            ...
        "#}#"       
    )



Regards,
Daniel
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Romel
Top achievements
Rank 1
answered on 09 May 2014, 06:30 PM
Hi Daniel,

Thanks for the reply. It worked like a charm!!!  =)

Romel
Tags
Grid
Asked by
Romel
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Romel
Top achievements
Rank 1
Share this question
or