binding data to the treelist control

前端 未结 1 1152
-上瘾入骨i
-上瘾入骨i 2021-01-16 12:55

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 u

相关标签:
1条回答
  • 2021-01-16 13:37

    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);
    
    0 讨论(0)
提交回复
热议问题