How to add check box in PanelBar

3 posts, 0 answers
  1. Umesh
    Umesh avatar
    6 posts
    Member since:
    Feb 2014

    Posted 06 Mar 2014 Link to this post

    Hi 
    How to add check box in panelbar item and binding data from entity framework.  
  2. Umesh
    Umesh avatar
    6 posts
    Member since:
    Feb 2014

    Posted 06 Mar 2014 Link to this post

    Please check below code :

    @(Html.Kendo().PanelBar()
        .Name("PanelBar")
        .HtmlAttributes(new { Styles = "width:10px" })
        .BindTo(Model, mappings =>
        {
            mappings.For<Header_PanelVM>(binding => binding
                    .ItemDataBound((item, category) =>
                    {
                        item.Text = category.HeaderName;
                        item.HtmlAttributes["id"] = category.HeaderName;

                    })
                    .Children(category => category.HList));
            mappings.For<HeaderList>(binding => binding
            .ItemDataBound((item, hearList) =>
            {
                item.Text = hearList.HeaderName;
                item.HtmlAttributes["onclick"] = "SelectChild('" + hearList.ParentHeaderName + "'," + hearList.HeaderId.ToString() + ")";

            }));
        })
        
    )
    in that i want to add check box,
    please help me how i add it to item
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 10 Mar 2014 Link to this post

    Hello Umesh,

    Basically the MVC helper does not allow you to inject HTML as a template or something. However you can turn the Encoded option to false and insert the html inside the Text of the item.

    e.g.

    panelbar.Add().Text("Fourth Item")
        .Items(items =>
        {
            items.Add().Text("Sub Item 1");
            items.Add().Text("<input type='checkbox' /> Sub Item 2").Encoded(false);

    The same approach can be applied to your case when using the BindTo builder.

    Kind Regards,
    Petur Subev
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top