@using Telerik.Web.Mvc.UI.Fluent; @using System.Xml.Linq; @model XElement @functions { void BindXElement(TreeViewItemFactory item, XElement elem){ var node = item.Add().Text(elem.Name.LocalName); foreach (var e in elem.Elements()) { node.Items(subItem => BindXElement(subItem, e)); } } } @(Html.Telerik().TreeView() .Name("TreeView") .Items(item => BindXElement(item, Model)) )
No comments:
Post a Comment