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

Building PanelBar Children Rescursively and Binding to Model

1 Answer 49 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Carrie
Top achievements
Rank 1
Carrie asked on 18 Sep 2013, 05:01 PM
Hello,

Is it possible to have the panelbar nesting be recursive?   Let's say we are binding to a list of objects inside the model like this:
public class Activity
   {
       public string ActivityId { get; set; }
       public string Description { get; set; }
       public List<Activity> Activities { get; set; }       
   }

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 20 Sep 2013, 10:40 AM
Hello Carrie,

This is the default binding behavior when the child items type is the same. You should just specify the mapping for the type and how the children can be accessed:

@(Html.Kendo().PanelBar()
      .Name("panelbar")
      .BindTo(Model, mappings =>
       {
           mappings.For<Activity>(binding => binding
               .ItemDataBound((item, activity) =>
                   {
                        item.Text = activity.Description;
                   })
               .Children(activity => activity.Activities));
       })
)
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
PanelBar
Asked by
Carrie
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or