I am successfully populating my treeview via the BindTo method. As you can see below, I bind to a single entity of type "Organisation" which has collection of child organisations called "ChildOrganisations". You can also see that I do some conditional formating of styles depending of the value of property "organisation.organisation_type_id"
As I bind the children nodes via the item.Text and item.Id properties, I also want to be able to add an image next to the node text. The image will be different depending on the value of a organisation.enabled. How can I do that?
@(Html.Kendo().TreeView() .Name("OrganisationTreeview") .ExpandAll(true) .BindTo(Model, mapping => mapping .For<Organisation>(binding => binding .Children(organisation => organisation.ChildOrganisations) .ItemDataBound((item, organisation) => { item.Text = organisation.organisation_unit_name; item.Id = organisation.organisation_unit_id.ToString(); if (organisation.organisation_type_id == 1) { item.HtmlAttributes.Add("style", "font-size: 18px;font-weight:bold;"); } else if (organisation.organisation_type_id == 3) { item.HtmlAttributes.Add("style", "font-size: 14px;font-weight:bold"); } else if (organisation.organisation_type_id == 2) { item.HtmlAttributes.Add("style", "font-size: 12px;font-weight:normal"); } }))))As I bind the children nodes via the item.Text and item.Id properties, I also want to be able to add an image next to the node text. The image will be different depending on the value of a organisation.enabled. How can I do that?