示例#1
0
        private void BindData()
        {
            ASPxTreeList1.ClearNodes();
            string pline = ASPxComboBoxPline.Value as string;
            //List<DetectBarCodeEntity> entity = db.Fetch<DetectBarCodeEntity>("where PLINE_CODE=@0 order by SEQ_LEVEL,SEQ_VALUE", pline);
            //ASPxTreeList1.DataSource = entity;
            //ASPxTreeList1.DataBind();

            //ASPxTreeList1.CellEditorInitialize += new DevExpress.Web.ASPxTreeList.TreeListColumnEditorEventHandler(ASPxTreeList1_CellEditorInitialize);
            //ASPxTreeList1.NodeValidating += new DevExpress.Web.ASPxTreeList.TreeListNodeValidationEventHandler(ASPxTreeList1_NodeValidating);
            //ASPxTreeList1.NodeInserting += new DevExpress.Web.Data.ASPxDataInsertingEventHandler(ASPxTreeList1_NodeInserting);
            //ASPxTreeList1.NodeUpdating += new DevExpress.Web.Data.ASPxDataUpdatingEventHandler(ASPxTreeList1_NodeUpdating);
            //ASPxTreeList1.NodeDeleting += new DevExpress.Web.Data.ASPxDataDeletingEventHandler(ASPxTreeList1_NodeDeleting);
            //ASPxTreeList1.HtmlRowPrepared += new DevExpress.Web.ASPxTreeList.TreeListHtmlRowEventHandler(ASPxTreeList1_HtmlRowPrepared);

            //手动加载节点  解决第一层老是按1,10,2,20,3,4。。。。。。的排序问题
            List <DetectBarCodeEntity> entity = db.Fetch <DetectBarCodeEntity>("where PLINE_CODE=@0 and SEQ_LEVEL=1 order by to_number(seq_value,'99')", pline);

            foreach (var d in entity)
            {
                TreeListNode tln = ASPxTreeList1.AppendNode(d.RMES_ID);
                tln["RMES_ID"] = d.RMES_ID;

                tln["PLINE_CODE"] = d.PLINE_CODE;
                tln["SEQ_NAME"]   = d.SEQ_NAME;
                tln["SEQ_VALUE"]  = d.SEQ_VALUE;
                tln["SEQ_FATHER"] = d.SEQ_FATHER;
                tln["SEQ_LEVEL"]  = d.SEQ_LEVEL;
                List <DetectBarCodeEntity> child = db.Fetch <DetectBarCodeEntity>("where PLINE_CODE=@0 and SEQ_LEVEL=2 and SEQ_FATHER=@1 order by SEQ_VALUE", pline, d.RMES_ID);
                for (int i = 0; i < child.Count; i++)
                {
                    TreeListNode ctln = ASPxTreeList1.AppendNode(child[i].RMES_ID, tln);
                    ctln["RMES_ID"] = child[i].RMES_ID;

                    ctln["PLINE_CODE"] = child[i].PLINE_CODE;
                    ctln["SEQ_NAME"]   = child[i].SEQ_NAME;
                    ctln["SEQ_VALUE"]  = child[i].SEQ_VALUE;
                    ctln["SEQ_FATHER"] = child[i].SEQ_FATHER;
                    ctln["SEQ_LEVEL"]  = child[i].SEQ_LEVEL;
                }
            }
        }