当前位置: 首页>>代码示例>>C#>>正文


C# WebControls.TreeView类代码示例

本文整理汇总了C#中System.Web.UI.WebControls.TreeView的典型用法代码示例。如果您正苦于以下问题:C# TreeView类的具体用法?C# TreeView怎么用?C# TreeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TreeView类属于System.Web.UI.WebControls命名空间,在下文中一共展示了TreeView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RschPropsListBuilder

 public static void RschPropsListBuilder(TreeView tw, int rschId)
 {
     var tasks = TaskManager.GetTasks(rschId).ToList<Task>();
     List<TaskNode> taskNodes = new List<TaskNode>();
     foreach (var task in tasks)
     {
         if (tw.Nodes.Count == 0)
         {
             tw.Nodes.Add(new TreeNode(TaskManager.GetTaskDescription(task.Type)));
             tw.Nodes[0].ChildNodes.Add(new TreeNode(task.Value));
         }
         else
         {
             bool placed = false;
             foreach (TreeNode n in tw.Nodes)
             {
                 if (n.Text == TaskManager.GetTaskDescription(task.Type))
                 {
                     n.ChildNodes.Add(new TreeNode(task.Value));
                     placed = true;
                 }
             }
             if (!placed)
             {
                 TreeNode tnode = new TreeNode(TaskManager.GetTaskDescription(task.Type));
                 tnode.ChildNodes.Add(new TreeNode(task.Value));
                 tw.Nodes.Add(tnode);
             }
         }
         //taskNodes.Add(new TaskNode(){Description = TaskManager.GetTaskDescription(task.Type), Value = task.Value});
     }
     //TaskManager.GetTaskDescription(1);
 }
开发者ID:alexkasp,项目名称:monitor,代码行数:33,代码来源:ReportsBuilder.cs

示例2: BindTreeview

 /// <summary>
 /// 
 /// </summary>
 /// <param name="treeview">树控件的ID</param>
 /// <param name="tablename">表名称</param>
 /// <param name="fieldText">数据名称</param>
 /// <param name="fieldValue">数据编号</param>
 /// <param name="FatherCode">父级编号</param>
 /// <param name="FatherValue">父级过滤条件</param>
 /// <param name="condition">条件语句</param>
 public void BindTreeview(TreeView treeview, string tablename, string fieldText, string fieldValue, string FatherCode, string FatherValue, string condition)
 {
     string str = "select " + fieldText + "," + fieldValue + "," + FatherCode + " from " + tablename + "  where " + condition;
     DataTable dt = DbHelperSQL.Query(str).Tables[0];
      DataRow[] Arr_datarow;
     //根据需求,要求根据人员的权限来设置机构数据
     if (FatherValue != "0")
     {
         Arr_datarow = dt.Select(fieldValue + "='" + FatherValue + "'");
     }
     else
     {
         Arr_datarow = dt.Select(FatherCode + "='" + FatherValue + "'");
     }
     treeview.Nodes.Clear();
     if (Arr_datarow.Length <= 0) return;
     foreach (DataRow dr in Arr_datarow)
     {
         TreeNode rootnode = new TreeNode();
         rootnode.Text = dr[fieldText].ToString().Trim();
         rootnode.Value = dr[fieldValue].ToString().Trim();
         //rootnode.SelectAction = TreeNodeSelectAction.Expand;
         treeview.Nodes.Add(rootnode);
         BindSubNode(dt, rootnode, fieldText, fieldValue, FatherCode);
     }
 }
开发者ID:SaintLoong,项目名称:ChangWu_IndustryPlatform,代码行数:36,代码来源:SYS_PositionDao.cs

示例3: CreateMaschinenAuswertung

		private void CreateMaschinenAuswertung (XmlDocument AuszaehlungsStand, TreeView AuszaehlungsTreeView)
			{
			TreeNode MaschinenRootNode = new TreeNode ("Abgegebene Stimmen pro Maschine");
			AuszaehlungsTreeView.Nodes.Add (MaschinenRootNode);
			XmlNode SprengelDatenNode = AuszaehlungsStand.DocumentElement.SelectSingleNode("child::" + MBRStatics.MBR_SPRENGEL_DATEN);
			XmlNode AltErlaaRootNode = SprengelDatenNode.LastChild;
			String MStiege = AltErlaaRootNode.Attributes[MBRStatics.MBR_STIEGE].Value;
			String MWohnungen = AltErlaaRootNode.SelectSingleNode("child::" + MBRStatics.MBR_WOHNUNGEN).InnerText;
			String MSchluessel = AltErlaaRootNode.SelectSingleNode("child::" + MBRStatics.MBR_SCHLUESSEL).InnerText;
			XmlNode MAbgegebenNode = AltErlaaRootNode.LastChild;
			foreach (XmlNode ZeitRaumNode in MAbgegebenNode.SelectNodes("child::" + MBRStatics.MBR_IM_ZEITRAUM))
				{
				String Von = ZeitRaumNode.Attributes[MBRStatics.MBR_VON].Value.Substring(5);
				String Bis = ZeitRaumNode.Attributes[MBRStatics.MBR_BIS].Value.Substring(5);
				TreeNode TreeZeitraumNode = new TreeNode ();
				if (ZeitRaumNode != MAbgegebenNode.LastChild)
					TreeZeitraumNode.Text = "Vom " + Von + " bis " + Bis;
				else
					TreeZeitraumNode.Text = "Insgesamt bis jetzt";
				MaschinenRootNode.ChildNodes.Add (TreeZeitraumNode);
				foreach (XmlNode Maschine in ZeitRaumNode.ChildNodes)
					{
					TreeNode MaschinenNode = new TreeNode (Maschine.InnerText + "   " + Maschine.Name);
					TreeZeitraumNode.ChildNodes.Add (MaschinenNode);
					}
				}
			}
开发者ID:heinzsack,项目名称:DEV,代码行数:27,代码来源:Stundenprofil.aspx.cs

示例4: ShowSelectionTree

		private void ShowSelectionTree ()
			{
			
			TreeView SelectionTreeView = new TreeView ();
			SelectionTreeView.CssClass = "CSS_SelectionTreeView";
			this.ContentPlaceHolderNavigationPlace.Controls.Add (SelectionTreeView);
			LoadPossibleValues ();
			TreeNode StartNode = new TreeNode ("Kalender Durchsuchen nach..");
			StartNode.SelectAction = TreeNodeSelectAction.Expand;
			SelectionTreeView.Nodes.Add (StartNode);
			foreach (DataTable Table in PossibleValues.Tables)
				{
				String TableName = Table.TableName;
				String ColumnName = Table.Columns [0].ColumnName;
				TreeNode TableNode = new TreeNode (ColumnName);
				TableNode.SelectAction = TreeNodeSelectAction.Expand;
				StartNode.ChildNodes.Add (TableNode);
				foreach (DataRow TableRow in Table.Rows)
					{
					String Entry = TableRow [0].ToString ();
					TreeNode ContentNode = new TreeNode (Entry);
					TableNode.ChildNodes.Add (ContentNode);
					ContentNode.NavigateUrl = "./WPMediaCalendarDisplay.aspx?Search=Future&Table=Kalender"
						+ "&Column=" + ColumnName + "&Entry=" + Entry;
					}
				TableNode.Collapse ();
				}
			}
开发者ID:heinzsack,项目名称:DEV,代码行数:28,代码来源:WPMediaCalendarDisplay.aspx.cs

示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            System.Web.UI.WebControls.TreeView NewTree = new TreeView();

            NewTree.ID = "BookTreeView";
            NewTree.DataSourceID = "BookXmlDataSource";


            TreeNodeBinding RootBinding = new TreeNodeBinding();
            RootBinding.DataMember = "Something";
            RootBinding.TextField = "Title";

            TreeNodeBinding ParentBinding = new TreeNodeBinding();
            ParentBinding.DataMember = "Chapter";
            ParentBinding.TextField = "Heading";

            TreeNodeBinding LeafBinding = new TreeNodeBinding();
            LeafBinding.DataMember = "Section";
            LeafBinding.TextField = "Heading";

            NewTree.DataBindings.Add(RootBinding);
            NewTree.DataBindings.Add(ParentBinding);
            NewTree.DataBindings.Add(LeafBinding);

            ControlPlaceHolder.Controls.Add(NewTree);
        }
开发者ID:Jarolim,项目名称:AllMyHomeworkForTelerikAcademy,代码行数:26,代码来源:XMLTreeView.aspx.cs

示例6: CreateSprengelAuswertung

		private void CreateSprengelAuswertung (XmlDocument AuszaehlungsStand, TreeView AuszaehlungsTreeView)
			{

			TreeNode StiegenRootNode = new TreeNode ("Abgegebene Stimmen pro Stiege");
			AuszaehlungsTreeView.Nodes.Add (StiegenRootNode);
			XmlNode SprengelContainer = AuszaehlungsStand.DocumentElement.SelectSingleNode
				("child::" + MBRStatics.MBR_SPRENGEL_DATEN);

			foreach (XmlNode StiegenNode in SprengelContainer.SelectNodes("child::" + MBRStatics.MBR_SPRENGEL))
				{
				String Stiege = StiegenNode.Attributes[MBRStatics.MBR_STIEGE].Value.Replace("_", "/");
				String Wohnungen = StiegenNode.SelectSingleNode("child::" + MBRStatics.MBR_WOHNUNGEN).InnerText;
				String Schluessel = StiegenNode.SelectSingleNode("child::" + MBRStatics.MBR_SCHLUESSEL).InnerText;
				XmlNode AbgegebenNode = StiegenNode.LastChild;
				XmlNode ImZeitRaumNode = AbgegebenNode.LastChild;
				if (ImZeitRaumNode == null)
					continue;
				XmlNode AlleNode = ImZeitRaumNode.LastChild;
				String Abgegeben = AlleNode.InnerText;
				TreeNode StiegenTreeNode = new TreeNode (Stiege + " - " + Wohnungen
								+ "(" + Schluessel + ") "
								+ Abgegeben + "    Stimmen bisher abgegeben");
				StiegenRootNode.ChildNodes.Add (StiegenTreeNode);
				if (ImZeitRaumNode != null)
					foreach (XmlNode Maschine in ImZeitRaumNode.ChildNodes)
						{
						TreeNode MaschinenNode = new TreeNode (Maschine.InnerText + "   " + Maschine.Name);
						StiegenTreeNode.ChildNodes.Add (MaschinenNode);

						}
				}

			}
开发者ID:heinzsack,项目名称:DEV,代码行数:33,代码来源:Stundenprofil.aspx.cs

示例7: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            TreeView newTree = new TreeView();
            newTree.ID = "BookTreeView";
            newTree.DataSourceID = "BooksXmlDataSource";

            TreeNodeBinding rootBinding = new TreeNodeBinding();
            rootBinding.DataMember = "catalog";
            rootBinding.Depth = 1;
            rootBinding.TextField = "#innerText";

            TreeNodeBinding authorBinding = new TreeNodeBinding();
            authorBinding.DataMember = "author";
            authorBinding.Depth = 2;
            authorBinding.TextField = "#innerText";
            authorBinding.FormatString = "author: {0}";

            TreeNodeBinding titleBinding = new TreeNodeBinding();
            titleBinding.DataMember = "title";
            titleBinding.Depth = 2;
            titleBinding.TextField = "#innerText";
            titleBinding.FormatString = "title: {0}";

            TreeNodeBinding genreBinding = new TreeNodeBinding();
            genreBinding.DataMember = "genre";
            genreBinding.Depth = 2;
            genreBinding.TextField = "#innerText";
            genreBinding.FormatString = "genre: {0}";

            TreeNodeBinding priceBinding = new TreeNodeBinding();
            priceBinding.DataMember = "price";
            priceBinding.Depth = 2;
            priceBinding.TextField = "#innerText";
            priceBinding.FormatString = "price: {0} USD";

            TreeNodeBinding publishDateBinding = new TreeNodeBinding();
            publishDateBinding.DataMember = "publish_date";
            publishDateBinding.Depth = 2;
            publishDateBinding.TextField = "#innerText";
            publishDateBinding.FormatString = "publish date: {0}";

            TreeNodeBinding descriptionBinding = new TreeNodeBinding();
            descriptionBinding.DataMember = "description";
            descriptionBinding.Depth = 2;
            descriptionBinding.TextField = "#innerText";
            descriptionBinding.FormatString = "description: {0}";

            newTree.DataBindings.Add(rootBinding);
            newTree.DataBindings.Add(authorBinding);
            newTree.DataBindings.Add(titleBinding);
            newTree.DataBindings.Add(genreBinding);
            newTree.DataBindings.Add(priceBinding);
            newTree.DataBindings.Add(publishDateBinding);
            newTree.DataBindings.Add(descriptionBinding);

            ControlPlaceHolder.Controls.Add(newTree);
        }
开发者ID:Vyara,项目名称:Telerik-Academy,代码行数:57,代码来源:Books.aspx.cs

示例8: TreeNodeStyleCollection_Method_Clear

		public void TreeNodeStyleCollection_Method_Clear () {
			TreeView tv = new TreeView ();
			tv.LevelStyles.Add (new TreeNodeStyle ());
			tv.LevelStyles.Add (new TreeNodeStyle ());
			tv.LevelStyles.Add (new TreeNodeStyle ());
			Assert.AreEqual (3, tv.LevelStyles.Count, "BeforeClear");
			tv.LevelStyles.Clear ();
			Assert.AreEqual (0, tv.LevelStyles.Count, "AfterClear");
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:TreeNodeStyleCollectionTest.cs

示例9: TreeNodeStyleCollection_Method_Contains

		public void TreeNodeStyleCollection_Method_Contains () {
			TreeView tv = new TreeView ();
			TreeNodeStyle tns = new TreeNodeStyle ();
			tv.LevelStyles.Add (new TreeNodeStyle ());
			Assert.AreEqual (false, tv.LevelStyles.Contains (tns), "BeforeContains");
			tv.LevelStyles.Add (tns);
			tv.LevelStyles.Add (new TreeNodeStyle ());
			Assert.AreEqual (true, tv.LevelStyles.Contains (tns), "AfterContains");
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:TreeNodeStyleCollectionTest.cs

示例10: TreeNodeBindingCollection_Method_Add

		public void TreeNodeBindingCollection_Method_Add () {
			TreeView tv = new TreeView ();
			Assert.AreEqual (0, tv.DataBindings.Count, "BeforeAdd");
			TreeNodeBinding tnb = new TreeNodeBinding ();
			tnb.DataMember = "TreeNodeBinding";
			tv.DataBindings.Add (tnb);
			Assert.AreEqual (1, tv.DataBindings.Count, "AfterAdd1");
			Assert.AreEqual ("TreeNodeBinding", tv.DataBindings[0].DataMember, "AfterAdd2");
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:TreeNodeBindingCollectionTest.cs

示例11: TreeNodeBindingCollection_Method_Clear

		public void TreeNodeBindingCollection_Method_Clear () {
			TreeView tv = new TreeView ();
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings.Add (new TreeNodeBinding ());
			Assert.AreEqual (3, tv.DataBindings.Count, "BeforeClear");
			tv.DataBindings.Clear ();
			Assert.AreEqual (0, tv.DataBindings.Count, "AfterClear");
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:TreeNodeBindingCollectionTest.cs

示例12: TreeNodeBindingCollection_Method_Contains

		public void TreeNodeBindingCollection_Method_Contains () {
			TreeView tv = new TreeView ();
			TreeNodeBinding tnb = new TreeNodeBinding ();
			tv.DataBindings.Add (new TreeNodeBinding ());
			Assert.AreEqual (false, tv.DataBindings.Contains (tnb), "BeforeContains");
			tv.DataBindings.Add (tnb);
			tv.DataBindings.Add (new TreeNodeBinding ());
			Assert.AreEqual (true, tv.DataBindings.Contains (tnb), "AfterContains");
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:TreeNodeBindingCollectionTest.cs

示例13: Copy

 public void Copy(TreeView treeview1, TreeView treeview2)
 {
     TreeNode newTn;
     foreach (TreeNode tn in treeview1.Nodes)
     {
         newTn = new TreeNode(tn.Text, tn.Value);
         CopyChilds(newTn, tn);
         treeview2.Nodes.Add(newTn);
     }
 }
开发者ID:N8Darby,项目名称:PReporter,代码行数:10,代码来源:WebForm2_downline.aspx.cs

示例14: TreeNodeBindingCollection_Method_CopyTo

		public void TreeNodeBindingCollection_Method_CopyTo () {
			TreeView tv = new TreeView ();
			TreeNodeBinding[] bindingArray = new TreeNodeBinding[10];
			tv.DataBindings.Add (new TreeNodeBinding ());
			TreeNodeBinding tnb = new TreeNodeBinding ();
			tnb.DataMember = "TreeNodeBinding";
			tv.DataBindings.Add (tnb);
			tv.DataBindings.Add (new TreeNodeBinding ());
			Assert.AreEqual (3, tv.DataBindings.Count, "BeforeCopyTo");
			tv.DataBindings.CopyTo (bindingArray, 3);
			Assert.AreEqual ("TreeNodeBinding", bindingArray[4].DataMember, "AfterCopyTo");
		}
开发者ID:nobled,项目名称:mono,代码行数:12,代码来源:TreeNodeBindingCollectionTest.cs

示例15: cargaTree

        public void cargaTree(TreeView t, List<Libro> lista)
        {
            List<string> categorias2 = lista.Select(unlibro => unlibro.Categoria).Distinct().ToList();

            foreach (string cat in categorias2)
            {
                t.Nodes.Add(new TreeNode(cat, cat));
            }
            t.Nodes.Add(new TreeNode("Todos", "Todos"));


        }
开发者ID:catalinGreu,项目名称:asp.net,代码行数:12,代码来源:MaestraVistasPrincipales.Master.cs


注:本文中的System.Web.UI.WebControls.TreeView类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。