本文整理汇总了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);
}
示例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);
}
示例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);
}
示例4: TreeView_NullDS
public void TreeView_NullDS ()
{
TreeView tv = new TreeView ();
tv.DataSource = null;
tv.DataBind ();
Assert.AreEqual (0, tv.Nodes.Count, "NullDS");
}
示例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");
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}