0

我有 2 张桌子。BranchDepartment 需要在TreeList.

一个分支可以有子分支,一个分支也可以有部门。我在一张表中维护 Branches 的关系Parent_Child_Branch ,我在一张表中维护 Branch 和 Department 的关系Branch_Department

如何在treelist.

实际上,我所做的是:我加入了Parent_Child_BranchandBranch以获得一个结果,另一个加入Branch_DepartmentandBranchDepartment另一个结果。我有Union All两个结果。

我正在获取union数据,但我正在获取重复的 ID。所以,我不能给一个keyIDto TreeList

我的查询:

var query1 = (from xx in VDC.SURVEY_PARENT_CHILD_BRANCH
              join yy in VDC.SURVEY_BRANCH on xx.PARENT_BRANCH_ID equals yy.BRANCH_ID
              join zz in VDC.SURVEY_BRANCH on xx.CHILD_BRANCH_ID equals zz.BRANCH_ID
              select new
              {
                  ParentBranchID = yy.BRANCH_ID,
                  ParentBranchName = yy.BRANCH_NAME,
                  ChildBranchID = zz.BRANCH_ID,
                  ChildBranchName = zz.BRANCH_NAME
              }).Concat(
                        from aa in VDC.SURVEY_BRANCH_DEPARTMENT
                        join bb in VDC.SURVEY_BRANCH on aa.BRANCH_ID equals bb.BRANCH_ID
                        join cc in VDC.SURVEY_DEPARTMENT on aa.DEPT_ID equals cc.DEPT_ID
                        select new
                        {
                            ParentBranchID = bb.BRANCH_ID,
                            ParentBranchName = bb.BRANCH_NAME,
                            ChildBranchID = cc.DEPT_ID,
                            ChildBranchName = cc.DEPT_NAME
                        }
                        );

我的树列表是:

<dx:ASPxTreeList ID="TreeList_Branch_Departments" 
    runat="server" 
    KeyFieldName="ChildBranchID" 
    ParentFieldName="ParentBranchID" 
    AutoGenerateColumns="false" 
    Theme="BlackGlass" 
    Height="410px"
    Width="534px" 
    Font-Size="11px" 
    Font-Names="calibri">
    <Columns>
        <dx:TreeListDataColumn FieldName="ChildBranchName" VisibleIndex="0" />           
    </Columns>
    <SettingsBehavior ExpandCollapseAction="NodeDblClick" />
</dx:ASPxTreeList>

希望,你明白我的问题。对不起我的交流。谁能给我一个解决方案。

4

0 回答 0