1

I'm having one table which contains the field as "IsBulitIn" & which is of bit type. Depending on the field value i filtered my table & i got to set of data . I used dataview for each type of data. Now i'm having two dataview's . I want to create two parent nodes at run time . The name may be "BuiltIn Group" & "My Group". & i want to set these two dataviews to the my above two parent node.

Is it possible by to set the datasource property to the each parent node?

thanks.

Priyanka
  • 2,802
  • 14
  • 55
  • 88

1 Answers1

1

Generally, there is a way to do this, though this way is not a straight forward. First, I should tell, that the TreeListNode class does not provide the DataSource property. So, it is impossible to just set a property and achieve the required effect. Anyway, I would suggest that you create child nodes for these nodes yourself:

void PopulateNodes(TreeListNode parentNode, DataView dataView) { 
            treeList1.BeginUnboundLoad();
            try {
                for(int i = 0; i < dataView.Count; i++) {
                    treeList1.AppendNode(new object[] { dataView[i]["SomeFieldName"] }, parentNode);
                }
            }
            finally {
                treeList1.EndUnboundLoad();
            }
        }

To add a parent node programmatically, use the following code:

    TreeListNode parentNode = treeList1.AppendNode(new object[] { "parent" }, null);
DevExpress Team
  • 11,338
  • 2
  • 24
  • 23
  • thanks for the reply.I've used the same technique. But when we add the nodes in this way then i think it is unbound technique of data adding. Can we add parent node pro-grammatically in the treelist? – Priyanka Apr 26 '11 at 05:05