實現treeview快速加載

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Stopwatch sw = new Stopwatch();
                sw.Start();node

                Getwsnode();ide


                Getrznode();
                Getxqnode();
                Getlhnode();
                Getzhnode();
                TreeView1.CollapseAll();
                Thread.Sleep(1000);
                sw.Stop();
                Response.Write(sw.Elapsed.ToString());
            }pwa

        }
        private void GetWS()
        {
            if (Session["WS"] == null)
            {
                List<T_WsxxModel> WSS = new List<T_WsxxModel>();
                T_WsxxBLL WScontrol = new T_WsxxBLL();
                WSS = WScontrol.GetModelList("");
                Session["WS"] = WSS;
            }
        }
        private void Getwsnode()
        {code

            List<TreeNode> treenodes = new List<TreeNode>();
            GetWS();
            List<T_WsxxModel> wss = (List<T_WsxxModel>)Session["WS"];
            wss.ForEach(L=>{
           
            TreeView1.Nodes.Add(new TreeNode(L.Wsname,L.Wsnum));
           
           
            });
          
        }
        private void GetRZ()
        {
            if (Session["RZ"] == null)
            {
                List<T_RzxxModel> RZS = new List<T_RzxxModel>();
                T_RzxxBLL RZcontrol = new T_RzxxBLL();
                RZS = RZcontrol.GetModelList("");
                Session["RZ"] = RZS;
            }
        }
        private void Getrznode()
        {
            GetRZ();
            List<T_RzxxModel> RZS = (List<T_RzxxModel>)Session["RZ"];
            foreach (TreeNode node in TreeView1.Nodes)
            {it

                RZS.FindAll(L => L.Wsnum == node.Value).ForEach(L => {io


                    node.ChildNodes.Add(new TreeNode(L.Rzname, L.Rznum));
               
               
                });
           
           
           
            }
        }
        private void GetXQ()
        {
            if (Session["XQ"] == null)
            {
                List<T_XqxxModel> XQS = new List<T_XqxxModel>();
                T_XqxxBLL RZcontrol = new T_XqxxBLL();
                XQS = RZcontrol.GetModelList("");
                Session["XQ"] = XQS;
            }
        }
        private void Getxqnode()
        {
            GetXQ();
            List<T_XqxxModel> xqs = (List<T_XqxxModel>)Session["XQ"];
            foreach (TreeNode nodews in TreeView1.Nodes)
            {
                foreach(TreeNode noderz in nodews.ChildNodes)
                {
                    noderz.ChildNodes.Clear();
                    xqs.FindAll(L => L.Rznum == noderz.Value).ForEach(L => {
                        noderz.ChildNodes.Add(new TreeNode(L.Xqname, L.Xqnum));
                   
                    });
                }
            }
        }
        private void GetLH()
        {
            if (Session["LH"] == null)
            {
                List<T_LhxxModel> LHS = new List<T_LhxxModel>();
                T_LhxxBLL LHcontrol = new T_LhxxBLL();
                LHS = LHcontrol.GetModelList("");
                Session["LH"] = LHS;
            }
        }
        private void Getlhnode()
        {class

            GetLH();
            List<T_LhxxModel> lhs = (List<T_LhxxModel>)Session["LH"];sed

            foreach (TreeNode nodews in TreeView1.Nodes)
            {
                foreach (TreeNode noderz in nodews.ChildNodes)
                {
                    foreach (TreeNode nodexq in noderz.ChildNodes)
                    {
                        nodexq.ChildNodes.Clear();
                        lhs.FindAll(L => L.Xqnum == nodexq.Value).ForEach(L =>
                        {
                            nodexq.ChildNodes.Add(new TreeNode(L.Lhname, L.Lhnum));object

                        });
                    }
                }
            }
       
       
        }
        private void GetZH()
        {
            if (Session["ZH"] == null)
            {
                List<T_ZhbxxModel> ZHS = new List<T_ZhbxxModel>();
                T_ZhbxxBLL ZHBcontrol = new T_ZhbxxBLL();
                ZHS = ZHBcontrol.GetModelList("");
                Session["ZH"] = ZHS;foreach

            }
        }
        private void Getzhnode()
        {

            GetZH();
            List<T_ZhbxxModel> zhs = (List<T_ZhbxxModel>)Session["ZH"];
            foreach (TreeNode nodews in TreeView1.Nodes)
            {
                foreach (TreeNode noderz in nodews.ChildNodes)
                {
                    foreach (TreeNode nodexq in noderz.ChildNodes)
                    {
                        foreach (TreeNode nodelh in nodexq.ChildNodes)
                        {
                            nodelh.ChildNodes.Clear();
                            zhs.FindAll(L => L.Lhnum == nodelh.Value).ForEach(L =>
                            {
                                nodelh.ChildNodes.Add(new TreeNode(L.Zhcode, L.zbnum));

                            });                         }                     }                 }             }                                 }

相關文章
相關標籤/搜索