<pre lang="c#">
Hello
I have a Database table for "Products Group" that has a field name "Parent ID". for example if you have "
Refrigerator" as you Product ID, it has the "
Kitchen Ware" ID as it's Parent ID. How can I have a treeList in DevExpress to have child nodes under it's parent? My database is SQL server.
I have add a treeList in my form that has 2 colomn, then add a class to fetch data from sql database :
public List<LocalProductGroups> GetProductGroups()
{
using (ShoppingEntities _ShoppingEntities = new ShoppingEntities())
{
return _ShoppingEntities.ProductGroup.Select(s => new LocalProductGroups
{
GroupID=s.GroupID,
Name=s.Name,
Parent=s.Parent
}).ToList();
}
}
public partial class LocalProductGroups
{
public int GroupID { get; set; }
public string Name { get; set; }
public int Parent { get; set; }
public bool IsRemove { get; set; }
}
data is shown in treelist but not in parent and child format, I mean all Product Goups are in one level.
Thanks in Advance
What I have tried:
I have tried my code above based on DevExpress documentations, but I have not met my answer.