Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/317.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# setValue()不';树列表绑定到数据源时不起作用_C#_Winforms_Devexpress_Treelist - Fatal编程技术网

C# setValue()不';树列表绑定到数据源时不起作用

C# setValue()不';树列表绑定到数据源时不起作用,c#,winforms,devexpress,treelist,C#,Winforms,Devexpress,Treelist,我遍历树列表以查找特定的树列表节点。此treeList1绑定到设计器中的数据源 for (int i =0; i<treeList1.Nodes.Count; i++) { if (GL_ID == treeList1.Nodes[i].GetValue(0).ToString()) { //treeList2 is unbound and it works treeList2.Nodes[0].SetValue(treeListColumn1, "m

我遍历树列表以查找特定的树列表节点。此
treeList1
绑定到设计器中的数据源

for (int i =0; i<treeList1.Nodes.Count; i++)
    {
     if (GL_ID == treeList1.Nodes[i].GetValue(0).ToString()) {
     //treeList2 is unbound and it works
     treeList2.Nodes[0].SetValue(treeListColumn1, "myval");
     treeList1.Nodes[i].SetValue(colGL_Name_VC, GL_Name_VC);
     treeList1.Nodes[i].SetValue(colBS_Category_VC, BS_Category_VC);
     treeList1.Nodes[i].SetValue(colStatus_BT, STATUS_BT);
break;
            }

for(int i=0;i如果TreeList配置正确,无论您是在绑定模式还是未绑定模式下使用控件,这种方法都应该有效。此外,如果您的任务是查找节点并更新其值,我建议您使用.method,而不是手动遍历节点。我在下面说明了这种方法的主要思想:

        var targetNode = treeList1.FindNodeByFieldValue(targetColumn.FieldName, GL_ID);
        targetNode.SetValue(colGL_Name_VC, GL_Name_VC);
        targetNode.SetValue(colBS_Category_VC, BS_Category_VC);
        targetNode.SetValue(colStatus_BT, STATUS_BT);

如果正确配置了TreeList,则无论您在绑定模式还是未绑定模式下使用控件,此方法都应该有效。此外,如果您的任务是查找节点并更新其值,我建议您使用.method,而不是手动迭代节点。我在下面说明了此方法的主要思想:

        var targetNode = treeList1.FindNodeByFieldValue(targetColumn.FieldName, GL_ID);
        targetNode.SetValue(colGL_Name_VC, GL_Name_VC);
        targetNode.SetValue(colBS_Category_VC, BS_Category_VC);
        targetNode.SetValue(colStatus_BT, STATUS_BT);