Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I have a table with parent child relation i.e.

id name parent
1 a 0
2 b 0
3 c 1
4 d 1
5 e 2
6 f 3

where 0 parent id means top level entity.Now I want to bind this with my grid in hierarchical manner i.e. parent -> child -- and so on.

Also user can add,edit and delete data from grid.
Posted
Updated 12-May-15 4:56am
v2
Comments
Sergey Alexandrovich Kryukov 12-May-15 10:57am    
What have you tried so far?
—SA
Rajesh R. Sharma 12-May-15 11:06am    
I have define a data objec as follows :
public class MyData
{
public BindingList<mydata> childStrategy { get; set; }

public int ID { get; set; }
public string Name{ get; set; }
public int ParentID { get; set; }
}
While loading I used recursion to properly prepare the data.Finally I bind the data with the grid.It worked but I want a better way.

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900