private void BindPaperCategoryTree()
        {
            PaperCategoryBLL paperCategoryBLL = new PaperCategoryBLL();

            //IList<RailExam.Model.PaperCategory> paperCategoryList = PaperCategoryBLL.GetPaperCategories();
            IList <RailExam.Model.PaperCategory> paperCategoryList = paperCategoryBLL.GetPaperCategories();

            Pub.BuildComponentArtTreeView(tvPaperCategory, (IList)paperCategoryList, "PaperCategoryId",
                                          "ParentId", "CategoryName", "CategoryName", "IdPath", null, null, null);

            //tvPaperCategory.ExpandAll();
        }
Beispiel #2
0
        private void BindPaperCategoryTree()
        {
            //string strCategoryID = Request.QueryString.Get("Op");

            PaperCategoryBLL paperCategoryBLL = new PaperCategoryBLL();

            //IList<RailExam.Model.PaperCategory> PaperCategoryList = PaperCategoryBLL.GetPaperCategories(int.Parse(strCategoryID));//选择考试试卷 PaperCategoryId=3
            IList <RailExam.Model.PaperCategory> paperCategoryList = paperCategoryBLL.GetPaperCategories();

            Pub.BuildComponentArtTreeView(tvPaperCategory, (IList)paperCategoryList, "PaperCategoryId",
                                          "ParentId", "CategoryName", "CategoryName", "IdPath", null, null, null);

            //tvPaperCategory.ExpandAll();
        }
        private void BindPaperCategoryTree()
        {
            PaperCategoryBLL paperCategoryBLL = new PaperCategoryBLL();

            IList <RailExam.Model.PaperCategory> paperCategoryList = paperCategoryBLL.GetPaperCategories();

            if (paperCategoryList.Count > 0)
            {
                TreeViewNode tvn = null;

                foreach (PaperCategory paperCategory in paperCategoryList)
                {
                    tvn         = new TreeViewNode();
                    tvn.ID      = paperCategory.PaperCategoryId.ToString();
                    tvn.Value   = paperCategory.PaperCategoryId.ToString();
                    tvn.Text    = paperCategory.CategoryName;
                    tvn.ToolTip = paperCategory.CategoryName;

                    if (paperCategory.ParentId == 0)
                    {
                        TreeView1.Nodes.Add(tvn);
                    }
                    else
                    {
                        try
                        {
                            TreeView1.FindNodeById(paperCategory.ParentId.ToString()).Nodes.Add(tvn);
                        }
                        catch
                        {
                            TreeView1.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }
            }

            TreeView1.DataBind();
            TreeView1.ExpandAll();
        }