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


C# TreeView.DataBind方法代码示例

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


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

示例1: pageLoadNodeExpandAll

		public static void pageLoadNodeExpandAll (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.CollapseAll ();
			tv.Nodes[0].ChildNodes[0].ExpandAll ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:17,代码来源:TreeViewTest.cs

示例2: pageLoadRenderDefaults

		public static void pageLoadRenderDefaults (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:15,代码来源:TreeViewTest.cs

示例3: pageLoadRenderLevelStyleCssClass

		public static void pageLoadRenderLevelStyleCssClass (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";

			TreeNodeStyle tns = new TreeNodeStyle ();
			tns.CssClass = "TestCssClass1";
			tv.LevelStyles.Add (tns);
			
			tns = new TreeNodeStyle ();
			tns.CssClass = "TestCssClass2";
			tv.LevelStyles.Add (tns);

			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:24,代码来源:TreeViewTest.cs

示例4: TreeView_NullDS

		public void TreeView_NullDS ()
		{
			TreeView tv = new TreeView ();
			tv.DataSource = null;
			tv.DataBind ();
			Assert.AreEqual (0, tv.Nodes.Count, "NullDS");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:7,代码来源:TreeViewTest.cs

示例5: TreeView_MaxDataBindDepth

		public void TreeView_MaxDataBindDepth () {
			TreeView tv = new TreeView ();
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.MaxDataBindDepth = 1;
			_TreeNodeDataBoundCount = 0;
			tv.TreeNodeDataBound += new TreeNodeEventHandler (TreeView_TreeNodeDataBound);
			Assert.AreEqual (0, tv.Nodes.Count, "BeforeDataBind1");
			tv.DataBind ();
			Assert.AreEqual (1, tv.Nodes.Count, "AfterDataBind1-a");
			Assert.AreEqual ("Book", tv.Nodes [0].Text, "AfterDataBind1-b");
			Assert.AreEqual (2, tv.Nodes [0].ChildNodes.Count, "AfterDataBind1-c");
			Assert.AreEqual (0, tv.Nodes [0].ChildNodes [0].ChildNodes.Count, "AfterDataBind1-d");
			Assert.AreEqual (3, _TreeNodeDataBoundCount, "AfterDataBind1-TreeNodeDataBoundCount");
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:17,代码来源:TreeViewTest.cs

示例6: pageLoadNodeStates2

		public static void pageLoadNodeStates2 (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].Checked = false;
			tv.Nodes[0].ChildNodes[0].Selected = true;
			tv.Nodes[0].ChildNodes[0].Expanded = false;
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].PopulateOnDemand = true;
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].ShowCheckBox = false;
			tv.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.Expand;
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:21,代码来源:TreeViewTest.cs

示例7: PostBackFireEvents_3

		public static void PostBackFireEvents_3 (Page p)
		{
			TreeView tv = new TreeView ();
			tv.TreeNodeCollapsed += new TreeNodeEventHandler (tv_TreeNodeCollapsed);
			tv.TreeNodeExpanded +=new TreeNodeEventHandler(tv_TreeNodeExpanded);
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].Checked = true;
			tv.Nodes[0].ChildNodes[0].Selected = false;
			tv.Nodes[0].ChildNodes[0].Expanded = true;
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].PopulateOnDemand = false;
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].ShowCheckBox = true;
			tv.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.SelectExpand;
			p.Form.Controls.Add (tv);

			
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:22,代码来源:TreeViewTest.cs

示例8: pageLoadInvisible

		public static void pageLoadInvisible (Page page) {
			TreeView tv = new TreeView ();
			tv.ID = "treeview1";
			tv.Visible = false;
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBindSmall;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:15,代码来源:TreeViewTest.cs

示例9: pageLoadNodeStrings

		public static void pageLoadNodeStrings (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			tv.Nodes[0].ToolTip = "string1";
			tv.Nodes[0].ImageToolTip = "string2";
			tv.Nodes[0].ChildNodes[0].ImageUrl = "string3";
			tv.Nodes[0].ChildNodes[0].NavigateUrl = "string4";
			tv.Nodes[0].ChildNodes[0].ChildNodes[0].Target = "string5";
			tv.Nodes[0].ChildNodes[0].ChildNodes[1].Text = "string6";
			tv.Nodes[0].ChildNodes[1].Value = "string7";
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:22,代码来源:TreeViewTest.cs

示例10: pageLoadImagesOn

		public static void pageLoadImagesOn (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			tv.CollapseImageToolTip = "Test111";
			tv.ExpandImageToolTip = "Test222";
			tv.CollapseImageUrl = "Test333";
			tv.ExpandImageUrl = "Test444";
			tv.NoExpandImageUrl = "Test555";
			tv.LineImagesFolder = "Test666";
			tv.ShowLines = true;
			tv.ShowExpandCollapse = true;
			tv.ImageSet = TreeViewImageSet.Custom;
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:24,代码来源:TreeViewTest.cs

示例11: pageLoadWrapOff

		public static void pageLoadWrapOff (Page page) {
			TreeView tv = new TreeView ();
			tv.ID = "treeview1";
			tv.NodeWrap = false;
			tv.Nodes.Add (new TreeNode ("TreeNode1"));
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:12,代码来源:TreeViewTest.cs

示例12: pageLoadValues

		public static void pageLoadValues (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			tv.ImageSet = TreeViewImageSet.Arrows;
			tv.SkipLinkText = "mySkipLinkText";
			tv.NodeIndent = 30;
			tv.ExpandDepth = 3;
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:19,代码来源:TreeViewTest.cs

示例13: pageLoadBindings

		public static void pageLoadBindings (Page page) {
			TreeView tv = new TreeView ();
			tv.EnableClientScript = false;
			tv.ID = "treeview1";
			tv.ImageSet = TreeViewImageSet.Arrows;
			tv.AutoGenerateDataBindings = false;
			tv.MaxDataBindDepth = 1;
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings[0].DataMember = "Book";
			tv.DataBindings[0].TextField = "Title";
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings[1].DataMember = "Chapter";
			tv.DataBindings[1].TextField = "Heading";
			tv.DataBindings.Add (new TreeNodeBinding ());
			tv.DataBindings[2].DataMember = "Section";
			tv.DataBindings[2].TextField = "Heading";
			XmlDataSource xmlds = new XmlDataSource ();
			xmlds.EnableCaching = false;
			xmlds.Data = xmlDataBind;
			tv.DataSource = xmlds;
			tv.DataBind ();
			LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG);
			LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG);
			page.Form.Controls.Add (lcb);
			page.Form.Controls.Add (tv);
			page.Form.Controls.Add (lce);
		}
开发者ID:JokerMisfits,项目名称:linux-packaging-mono,代码行数:27,代码来源:TreeViewTest.cs

示例14: ExplandTreeNode

 private void ExplandTreeNode(TreeView tr)
 {
     TreeNode root = tr.SelectedNode;
     if (root != null)
     {
         int rid = int.Parse(root.Value);
         var cs = logic.GetChildren(rid);
         if (cs.Count() != 0)
         {
             root.ChildNodes.Clear();
             foreach (Brand b in cs.First().ChildBrandSet)
             {
                 TreeNode node = new TreeNode();
                 node.Text = b.BrandName;
                 node.Value = b.ID.ToString();
                 root.ChildNodes.Add(node);
             }
         }
         else
         {
             root.ChildNodes.Clear();
             cs = logic.GetRootBrand();
             foreach (Brand b in cs)
             {
                 TreeNode node = new TreeNode();
                 node.Text = b.BrandName;
                 node.Value = b.ID.ToString();
                 root.ChildNodes.Add(node);
             }
         }
         tr.DataBind();
     }
 }
开发者ID:eavia,项目名称:tts,代码行数:33,代码来源:BrandList.aspx.cs

示例15: BuildRootNode

 private void BuildRootNode(TreeView tr)
 {
     tr.Nodes.Clear();
     TreeNode node = new TreeNode();
     node.Text = "根目录";
     node.Value = "0";
     tr.Nodes.Add(node);
     tr.DataBind();
 }
开发者ID:eavia,项目名称:tts,代码行数:9,代码来源:BrandList.aspx.cs


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