Hi Ramon,
Thanks for contacting Syncfusion support.
We can load hierarchical XML data in TreeGrid by using XMLSerializer class.
Please find the steps to render a TreeGrid with hierarchical XML data.
1. Copy XML file content in clipboard.
2. Created a class file using Paste Special option in visual studio, please find the screen shot below.
3. In this support XML file’s equivalent class file is created.
4. Then we can retrieve the data from XML file by using XML Serializer with type of created class, please find the code snippet below.
protected void Page_Load(object sender, EventArgs e)
{
XmlSerializer serializer = new XmlSerializer(typeof(GanttXML));
GanttXML obj = new GanttXML();
using (FileStream stream = File.OpenRead(Server.MapPath("~/App_Data/GanttXML.xml")))
{
obj = (GanttXML)serializer.Deserialize(stream);
}
this.TreeGrid1.DataSource = obj.Task;
this.TreeGrid1.DataBind();
} |
5. In client side we can map the child items by using “childMapping” property, please find the code snippet below.
<ej:TreeGrid runat="server" ID="TreeGrid1" ChildMapping="Children">
</ej:TreeGrid> |
We have prepared sample for this, please find the sample from below location
Regards,
Jone sherine P S