Conditional in Client Template

2 posts, 0 answers
  1. David
    David avatar
    6 posts
    Member since:
    Sep 2015

    Posted 30 May Link to this post

    Hello,

    I'm trying to display a list of checkbox items inside of a list view ONLY if the boolean isSelected field is false.

    Here is how I call the listview:
    @(Html.Kendo().ListView<TestMultiSelect.ViewModels.TestVM>(Model)
            .Name("listView")
            .TagName("div")
            .ClientTemplateId("template")
            .DataSource(dataSource => dataSource
                .PageSize(20)
                .ServerOperation(false)
             )
            )

    My TestView model:
    public class TestVM
        {
            public int ID { get; set; }
            public string Name { get; set; }
            public bool IsSelected { get; set; }
        }


    ..and here is my Client template:

    <script type="text/x-kendo-tmpl" id="template">
        <div class="product">
            # var isSelected =  @#:IsSelected#;
            if (isSelected !== true) { # @(Html.Kendo().CheckBox().Name("#:ID#").Label("#:Name#"))  # } #
        </div>
    </script>

    I get a failure in the client template.

    Any suggestions are appreciated.

    Thanks in advance,
    Dave
  2. Venelin
    Admin
    Venelin avatar
    352 posts

    Posted 31 May Link to this post

    Hello David,

    Your question was answered in the support ticket you sent. Please avoid duplicating threads so we can better track the issues discussed.

    Regards,
    Venelin
    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
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top