本文整理汇总了C#中System.Web.UI.WebControls.TreeNodeCollection类的典型用法代码示例。如果您正苦于以下问题:C# TreeNodeCollection类的具体用法?C# TreeNodeCollection怎么用?C# TreeNodeCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TreeNodeCollection类属于System.Web.UI.WebControls命名空间,在下文中一共展示了TreeNodeCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddDirectory
public void AddDirectory(TreeNodeCollection nodes, CmsDirectory dir)
{
TreeNode node = new TreeNode();
node.NavigateUrl = dir.FileType.BrowseUrl + "?FileID=" + dir.ID;
node.Text = dir.Title;
node.Value = dir.FileID.ToString();
if (CurrentFile != null && CurrentFile.IsDescendantOf(dir)) {
node.ImageUrl = dir.FileType.Module.ResourceFolder + "/images/icon_" + dir.FileType.CssClass + "_open.png";
if (CurrentFile.ID == dir.ID || CurrentFile.ParentID == dir.ID) {
node.Selected = true;
}
} else {
node.Expanded = false;
node.ImageUrl = dir.FileType.Module.ResourceFolder + "/images/icon_" + dir.FileType.CssClass + ".png";
}
nodes.Add(node);
if (dir.Subdirectories.Count > 0) {
if (CurrentFile != null && CurrentFile.IsDescendantOf(dir) && CurrentFile.FileID != dir.FileID) {
node.Expanded = true;
foreach (CmsDirectory sub in dir.Subdirectories) {
if (sub.State != CmsState.Deleted) {
AddDirectory(node.ChildNodes, sub);
}
}
} else {
node.PopulateOnDemand = true;
}
}
}
开发者ID:sffogg,项目名称:Xenosynth,代码行数:34,代码来源:FileExplorer.ascx.cs
示例2: TreeNodeCollection_Method_Add
public void TreeNodeCollection_Method_Add () {
TreeNodeCollection tnc = new TreeNodeCollection ();
Assert.AreEqual (0, tnc.Count, "BeforeAdd");
tnc.Add (new TreeNode ("TreeNodeName"));
Assert.AreEqual (1, tnc.Count, "AfterAdd1");
Assert.AreEqual ("TreeNodeName", tnc[0].Text, "AfterAdd2");
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:TreeNodeCollectionTest.cs
示例3: TreeNodePopulate
//Populate tree node
public void TreeNodePopulate(TreeNodeCollection nodes, IToken token)
{
//Parents nodes
treeNodes = authorManager.getAllPermission();
treeNodes.Merge(authorManager.getAuthoritiesByToken(token));
CreateRootNode(nodes);
}
开发者ID:wra222,项目名称:testgit,代码行数:8,代码来源:TreeViewControl.cs
示例4: PopulateNodes2
private void PopulateNodes2(TreeNodeCollection nodes, int parent)
{
ZhuJi.Portal.IDAL.IPlugin plugin = ZhuJi.AOP.Operator.WrapInterface(typeof(ZhuJi.Portal.NHibernateDAL.Plugin)) as ZhuJi.Portal.IDAL.IPlugin;
IList<ZhuJi.Portal.Domain.Plugin> list = plugin.GetObjects();
ZhuJi.Portal.Domain.PluginCollection plugins = new ZhuJi.Portal.Domain.PluginCollection();
DataTable dt = plugins.CreateDateTable(list);
DataRow[] drs = dt.Select(string.Format("[Parent] = {0}", parent));
if (drs.Length == 0)
{
return;
}
else
{
foreach (DataRow dr in drs)
{
TreeNode tn = new TreeNode();
tn.Text = dr["Title"].ToString();
tn.Value = dr["Id"].ToString();
if (dt.Select(string.Format("[Parent] = {0}", tn.Value)).Length > 0)
{
tn.PopulateOnDemand = true;
}
tn.NavigateUrl = string.Format("AddIn.aspx?PluginId={0}", dr["Id"]);
nodes.Add(tn);
}
}
}
开发者ID:BGCX261,项目名称:zhuji-cms-svn-to-git,代码行数:29,代码来源:Default.aspx.cs
示例5: BuildItems
private void BuildItems(TreeNodeCollection items, bool isRoot, bool isExpanded, HtmlTextWriter writer)
{
if (items.Count > 0)
{
writer.WriteLine();
writer.WriteBeginTag("ul");
if (isRoot)
{
writer.WriteAttribute("id", this.ClientID);
}
writer.Write(HtmlTextWriter.TagRightChar);
writer.Indent++;
foreach (System.Web.UI.WebControls.TreeNode item in items)
{
BuildItem(item, writer);
}
writer.Indent--;
writer.WriteLine();
writer.WriteEndTag("ul");
}
}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:25,代码来源:TreeView.cs
示例6: InitTreeNode
private void InitTreeNode(TreeNodeCollection Nds, string UpDir)
{
string AbsPath = this.AppPath + UpDir + "/";
AbsPath = AbsPath.Replace("/", @"\");
AbsPath = AbsPath.Replace(@"\\", @"\");
TreeNode tmpNd;
string search = "UploadFile.aspx?Dir=";
DataTable dt = FileSystemObject.GetDirectoryInfos(AbsPath, FsoMethod.Folder);
foreach (DataRow dr in dt.Rows)
{
tmpNd = new TreeNode();
string objPath=UpDir+"/"+dr["Name"].ToString();
tmpNd.Value = dr["Name"].ToString();
tmpNd.Text = dr["Name"].ToString();
tmpNd.NavigateUrl = search + base.Server.UrlEncode(objPath);
tmpNd.Target = "main_right";
Nds.Add(tmpNd);
string NextDir=UpDir+"/"+tmpNd.Value;
string aPath = this.AppPath + NextDir + "/";
aPath = aPath.Replace("/", @"\");
aPath = aPath.Replace(@"\\", @"\");
if (FileSystemObject.GetDirectoryInfos(aPath, FsoMethod.Folder).Rows.Count > 0)
{
InitTreeNode(tmpNd.ChildNodes, NextDir);
}
}
}
开发者ID:caisimongit,项目名称:cms-1,代码行数:27,代码来源:UploadDir.aspx.cs
示例7: BindTreeByDataTable
public static void BindTreeByDataTable(
TreeNodeCollection nodes,
DataTable _idt, string sIDRoot,
string sTextString, string sNavigateUrlString, string sValueString, string sToolTipString,
string sTextField, string sNavigateUrlField, string sValueField, string sToolTipField)
{
foreach (DataRow idr in _idt.Rows)
{
if (idr[sValueField].ToString() == sIDRoot.TrimEnd())
{
//子結點
BindTreeByDataTable(nodes, _idt, sTextString, idr[sValueField].ToString(),
sNavigateUrlString, sValueString, sToolTipString,
sTextField, sNavigateUrlField, sValueField, sToolTipField);
//子內容
TreeNode newnode = new TreeNode();
newnode.Text = string.Format(sTextString, idr[sTextField].ToString());
newnode.NavigateUrl = string.Format(sNavigateUrlString, idr[sNavigateUrlField].ToString());
newnode.Value = string.Format(sValueString, idr[sValueField].ToString());
newnode.ToolTip = string.Format(sToolTipString, idr[sToolTipField].ToString());
newnode.Target = "e2content";
nodes.Add(newnode);
}
}//end foreach
}//end BindTreeByDataTable
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:28,代码来源:TreeViewHelper.cs
示例8: GetTreeNode
private static TreeNode GetTreeNode(string name, string value, TreeNodeCollection parent, PackagePreferences preferences)
{
TreeNode result = new TreeNode(name, value);
result.ShowCheckBox = true;
parent.Add(result);
result.Checked = preferences == null || !preferences.IsInvalidPath(result.ValuePath);
return result;
}
开发者ID:cdrewery,项目名称:Umbraco-Public,代码行数:8,代码来源:BuildPackage.aspx.cs
示例9: SetSelectNodeUrls
private void SetSelectNodeUrls(TreeNodeCollection nodes)
{
foreach (TreeNode node in nodes)
{
node.NavigateUrl = "javascript:selectNode('" + node.Value +
"','" + node.Text + "');";
SetSelectNodeUrls(node.ChildNodes);
}
}
开发者ID:Wangweizhou,项目名称:Visual-Studio-Experiments,代码行数:9,代码来源:SelectTree.aspx.cs
示例10: TreeNodeCollection_Method_AddAt
public void TreeNodeCollection_Method_AddAt () {
TreeNodeCollection tnc = new TreeNodeCollection ();
tnc.Add (new TreeNode ());
tnc.Add (new TreeNode ());
Assert.AreEqual (2, tnc.Count, "BeforeAddAt");
tnc.AddAt (1, new TreeNode ("TreeNodeName"));
Assert.AreEqual (3, tnc.Count, "AfterAddAt1");
Assert.AreEqual ("TreeNodeName", tnc[1].Text, "AfterAdd2");
}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:TreeNodeCollectionTest.cs
示例11: FillChildren
/// <summary>
/// 递归填充子节点
/// </summary>
private static void FillChildren(DataRow parentType, TreeNodeCollection parentNode, DataTable dt)
{
foreach (var type in dt.Select(string.Format("PARENT_ID='{0}'", parentType["ID"]), "FUN_SORT ASC"))
{
var node = CreatNode(type);
parentNode.Add(node);
FillChildren(type, node.ChildNodes, dt);
}
}
开发者ID:ssjylsg,项目名称:crm,代码行数:12,代码来源:WebSysFunctionsTree.cs
示例12: BuildNodes
private void BuildNodes(TreeNode parent, TreeNodeCollection nodeCollectionToAddTo)
{
IEnumerable<TreeNode> nodes = _levelBuilders
.Where(level => level.ShouldRun(parent))
.SelectMany(level => level.GetChildNodes(parent));
foreach (TreeNode node in nodes)
{
nodeCollectionToAddTo.Add(node);
}
}
开发者ID:jpoehls,项目名称:snippets,代码行数:10,代码来源:TreeFactory.cs
示例13: TreeNodePopulate
//Populate tree node
public void TreeNodePopulate(TreeNodeCollection nodes)
{
//Parents nodes
treeNodes = authMgr.GetAllPermissionList();
CreateRootNode(nodes);
//Children nodes
//DataTable treeNodeChildren = new DataTable();
//treeNodeChildren = authMgr.getAllPermission();
//CreateTreeNode(treeNodeChildren, node);
}
开发者ID:wra222,项目名称:testgit,代码行数:11,代码来源:TreeViewControl.cs
示例14: GetInnerXml
private static string GetInnerXml(TreeNodeCollection childNodes, int offSet)
{
StringBuilder strBuilder = new StringBuilder();
string offsetStr = new string(' ', offSet);
foreach (TreeNode childNode in childNodes)
{
strBuilder.Append(offsetStr + childNode.Text + "<br />");
strBuilder.Append(GetInnerXml(childNode.ChildNodes, offSet + 2));
}
return strBuilder.ToString();
}
开发者ID:tockata,项目名称:ASP.NET-WebForms,代码行数:12,代码来源:XmlTreeView.aspx.cs
示例15: InitTree
//递归调用显示子树
public void InitTree(TreeNodeCollection nds, string parentId)
{
TreeNode tn;
DataSet dt = new DataSet();
DataRow[] rows = dt.Tables[0].Select("parent_Id='" + parentId + "'");
foreach (DataRow row in rows)
{
tn = new TreeNode(row["title"].ToString(), row["Files_Id"].ToString(), "images/1.gif", row["NavigateUrl"].ToString(), "");
nds.Add(tn);
InitTree(tn.ChildNodes, row["Files_Id"].ToString()); //递归
}
}
开发者ID:ZhuangChen,项目名称:CSharpBasicTraining,代码行数:14,代码来源:09NaigatorControls.aspx.cs
示例16: AddNodes
private void AddNodes(TreeNodeCollection nodes, int level, System.Data.DataTable dt)
{
string filterExp = string.Format("parentid='{0}'", level);
foreach (System.Data.DataRow r in dt.Select(filterExp))
{
TreeNode item = new TreeNode()
{
Text = r["name"].ToString(),
Value = r["id"].ToString()
};
this.AddNodes(item.ChildNodes, int.Parse(r["id"].ToString()), dt);
nodes.Add(item);
}
}
开发者ID:pbekker,项目名称:justforteachers.co.za,代码行数:14,代码来源:ResourceUpload.ascx.cs
示例17: ExpandToDepth
/// <summary>
/// Expands all tree elements with a depth less than the specified depth.
/// </summary>
/// <param name="nodes">The nodes.</param>
/// <param name="expandDepth">The expand depth.</param>
public static void ExpandToDepth(TreeNodeCollection nodes, int expandDepth)
{
if (nodes != null)
{
foreach (TreeNode node in nodes)
{
if (node.Depth < expandDepth)
{
node.Expand();
ExpandToDepth(node.ChildNodes, expandDepth);
}
}
}
}
开发者ID:JenasysDesign,项目名称:BootstrapControlAdapters,代码行数:19,代码来源:TreeViewAdapter.cs
示例18: SpecChildTree
public void SpecChildTree(TreeNodeCollection Nds, int SpecCateID)
{
TreeNode tmpNd;
DataTable ds = this.dspec.GetSpecList(SpecCateID);
foreach (DataRow dr in ds.Rows)
{
tmpNd = new TreeNode();
tmpNd.Value = dr["SpecID"].ToString();
tmpNd.Text = dr["SpecName"].ToString();
tmpNd.NavigateUrl = "SpecContent.aspx?SpecID=" + tmpNd.Value;
tmpNd.Target = "main_right";
Nds.Add(tmpNd);
}
}
开发者ID:caisimongit,项目名称:cms-1,代码行数:14,代码来源:B_SpecCate.cs
示例19: InitTreeNode
/// <summary>
/// 专题选择的专题树
/// </summary>
/// <param name="Nds"></param>
public void InitTreeNode(TreeNodeCollection Nds)
{
TreeNode tmpNd;
DataTable dtcate = dal.GetCateList();
foreach (DataRow dr in dtcate.Rows)
{
tmpNd = new TreeNode();
tmpNd.Value = dr["SpecCateID"].ToString();
tmpNd.Text = dr["SpecCateName"].ToString();
tmpNd.NavigateUrl = "javascript:category();";
tmpNd.Target = "";
Nds.Add(tmpNd);
InitSpecTree(tmpNd.ChildNodes, DataConverter.CLng(tmpNd.Value));
}
}
开发者ID:caisimongit,项目名称:cms-1,代码行数:19,代码来源:B_SpecCate.cs
示例20: PopulateNodes
private void PopulateNodes(DataTable dt, TreeNodeCollection nodes)
{
foreach (DataRow dr in dt.Rows)
{
TreeNode tn = new TreeNode();
string namethai = BLL.Curriculum.renameThai(dr["StructSub_Code"].ToString());
tn.Text = dr["StructSub_Code"].ToString(); //+ "<br/> วิชา : " + namethai.Substring(0,5)+"..";
tn.Value = dr["StructSub_Code"].ToString();
nodes.Add(tn);
//If node has child nodes, then enable on-demand populating
tn.PopulateOnDemand = ((int)(dr["childnodecount"]) > 0);
}
}
开发者ID:AppCPC,项目名称:WebComSci,代码行数:16,代码来源:TreeSearchNodeSubject.aspx.cs
注:本文中的System.Web.UI.WebControls.TreeNodeCollection类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论