本文整理汇总了C#中System.Web.UI.WebControls.TreeNode.Collapse方法的典型用法代码示例。如果您正苦于以下问题:C# TreeNode.Collapse方法的具体用法?C# TreeNode.Collapse怎么用?C# TreeNode.Collapse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.TreeNode
的用法示例。
在下文中一共展示了TreeNode.Collapse方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateTreeView
int PopulateTreeView(TagElements parentTag, int curentPosition, TreeNode parentNode)
{
// parentTag.hierarchicalPosition = curentPosition;
int j = 0;
foreach (TagElements tag in tagMap)
{
if (tag == null) break;
if (tag.parentName == parentTag.tagName)
{
TreeNode curentNode = new TreeNode();
curentNode.Text = tag.tagName;
curentNode.NavigateUrl = "TagInfo.aspx?tagName=" + tag.tagName;
curentNode.Collapse();
parentNode.ChildNodes.Add(curentNode);
PopulateTreeView(tag, curentPosition + 1, curentNode);
}
j++;
// Response.Write(tag.tagName + " " + tag.parentName + "<br />");
}
return 0;
}
示例2: buildAsyncSub
//string js = @"function ";Page.Server.UrlEncode
void buildAsyncSub(string pageUrl, string webUrl, SPFolder root, TreeNodeCollection nodes )
{
foreach (SPFolder f in root.SubFolders)
{
//if (f.Name.ToLower() == "forms") continue;
if (IsHiddenFolder(f)) continue;
TreeNode n = new TreeNode();
n.Text = f.Name ; // +"(" + f.Files.Count + ")";
n.ImageUrl = "/_layouts/images/folder.gif";
n.Collapse();
n.NavigateUrl = String.Format("javascript:TreeListViewWebPart_LoadFolderContent('{0}','{1}')", pageUrl ,(webUrl + f.Url));
nodes.Add(n);
buildAsyncSub(pageUrl, webUrl, f, n.ChildNodes);
}
}
示例3: 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 ();
}
}
示例4: AddTask
private void AddTask(TreeNode parent, IAzManItem item, TreeNode applicationNode)
{
TreeNode node = new TreeNode(item.Name, item.Name, this.getImageUrl("Task_16x16.gif"));
node.ToolTip = item.Description;
parent.ChildNodes.Add(node);
foreach (IAzManItem subItem in item.Members.Values)
{
if (subItem.ItemType == ItemType.Task)
{
this.AddTask(node, subItem, applicationNode);
}
}
if (item.Application.Store.Storage.Mode == NetSqlAzManMode.Developer)
{
foreach (IAzManItem subItem in item.Members.Values)
{
if (subItem.ItemType == ItemType.Operation)
{
this.AddOperation(node, subItem, applicationNode);
}
}
}
node.Collapse();
}
示例5: AddOperation
private void AddOperation(TreeNode parent, IAzManItem item, TreeNode applicationNode)
{
TreeNode node = new TreeNode(item.Name, item.Name, this.getImageUrl("Operation_16x16.gif"));
node.ToolTip = item.Description;
parent.ChildNodes.Add(node);
foreach (IAzManItem subItem in item.Members.Values)
{
this.AddOperation(node, subItem, applicationNode);
}
node.Collapse();
}
示例6: add
private void add(TreeNode parent, IAzManApplication app)
{
TreeNode node = new TreeNode(app.Name, app.Name, this.getImageUrl("Application_16x16.gif"));
node.ToolTip = app.Description;
parent.ChildNodes.Add(node);
node.Expand();
foreach (IAzManItem item in app.Items.Values)
{
if (item.ItemType == ItemType.Role)
{
if (item.ItemsWhereIAmAMember.Count == 0) this.AddRole(node, item, node);
}
}
foreach (IAzManItem item in app.Items.Values)
{
if (item.ItemType == ItemType.Task)
{
if (item.ItemsWhereIAmAMember.Count == 0) this.AddTask(node, item, node);
}
}
if (app.Store.Storage.Mode == NetSqlAzManMode.Developer)
{
foreach (IAzManItem item in app.Items.Values)
{
if (item.ItemType == ItemType.Operation)
{
if (item.ItemsWhereIAmAMember.Count == 0) this.AddOperation(node, item, node);
}
}
}
node.Collapse();
}
示例7: recurseSOATree
private TreeNode[] recurseSOATree(SOA soa)
{
string strCPU = null;
string strWCF = null;
string strASPNET = null;
if (soa.ConnectedSOAs == null || soa.ConnectedSOAs.Count == 0)
return null;
TreeNode[] returnNodes = new TreeNode[soa.ConnectedSOAs.Count];
for (int i = 0; i < soa.ConnectedSOAs.Count; i++)
{
int imageIndex = 0;
if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_CIRCULAR_REF_TERMINAL))
imageIndex = 3;
else
if (soa.ConnectedSOAs[i].Status.Equals(ConfigSettings.MESSAGE_OFFLINE))
imageIndex = 1;
string rootName = "<span><Font color='#84BDEC'>" + soa.ConnectedSOAs[i].SOAName + "</font></span>";
TreeNode root = new TreeNode(rootName, imageIndex.ToString(), imageList[imageIndex]);
root.ToolTip = "Connected Service Domain";
root.Expand();
imageIndex = 0;
int offset = 0;
string prefix = "";
string deployment = "";
string display="";
if (soa.ConnectedSOAs[i].MyVirtualHost != null)
{
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count > 0 && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0] != null)
{
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
offset = 0;
else
{
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform!=null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("azure"))
{
offset = 1;
prefix = "Azure Platform Cloud Deployed ";
}
else
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform != null && soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[0].RuntimePlatform.ToLower().Contains("hyper"))
{
offset = 2;
prefix = "On-premise Deployed (Hyper-V) ";
}
else
{
offset = 0;
prefix = "On-premise Deployed ";
}
}
}
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_ONLINE)
imageIndex = 4 + offset;
else
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_OFFLINE)
imageIndex = 7 + offset;
else
if (soa.ConnectedSOAs[i].MyVirtualHost.Status == ConfigSettings.MESSAGE_SOME_NODES_DOWN)
imageIndex = 10 + offset;
TreeNode myVHost = new TreeNode(prefix + soa.ConnectedSOAs[i].MyVirtualHost.VHostName, imageIndex.ToString(), imageList[imageIndex]);
myVHost.Expand();
TreeNode[] clusterNodes = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count];
for (int h = 0; h < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes.Count; h++)
{
TreeNode primaryEPs = new TreeNode("", "23", imageList[23]);
primaryEPs.ToolTip = "Primary Endpoints are those defined by the business application developer to service business requests via their custom business logic.";
primaryEPs.Collapse();
TreeNode configEPs = new TreeNode("", "22", imageList[22]);
configEPs.ToolTip = "Configuration Service Endpoints are infrastructure endpoints available for the Configuration Service itself, for example an endpoint to which ConfigWeb connects.";
configEPs.Collapse();
// TreeNode dcEPs = new TreeNode("", "24", imageList[24]);
// dcEPs.Collapse();
TreeNode[] endPointNodesPrimary = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count];
TreeNode[] endPointNodesConfig = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].ConfigServiceListenEndpoints.Count];
// TreeNode[] endPointNodesDC = new TreeNode[soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].DCServiceListenEndpoints.Count];
for (int j = 0; j < soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints.Count; j++)
{
string NAT = "";
string NAT2 = "";
int endPointImageIndex = 0;
switch (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].Status)
{
case ConfigSettings.MESSAGE_ONLINE: { endPointImageIndex = 25; break; }
case ConfigSettings.MESSAGE_OFFLINE: { endPointImageIndex = 26; break; }
case ConfigSettings.MESSAGE_UNKNOWN: { endPointImageIndex = 27; break; }
}
if (soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceType.Equals(1))
{
NAT = "<span style=\"color:#FFFFFF\"> --> {" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].LoadBalanceAddress + "}</span>";
NAT2 = "<span style=\"color:#FFFFFF\"> --> {NAT Load-Balanced}</span>";
}
TreeNode endpointnode = null;
if (CheckBoxEndpointDetail.Checked)
{
endpointnode = new TreeNode("<span style=\"color:#848483;\">" + soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].RemoteAddress + "</span>" + NAT, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
}
else
{
endpointnode = new TreeNode("<span style=\"color:#848483;\">" +soa.ConnectedSOAs[i].MyVirtualHost.ServiceNodes[h].PrimaryListenEndpoints[j].ServiceFriendlyName + "</span>" + NAT2, endPointImageIndex.ToString(), imageList[endPointImageIndex]);
//.........这里部分代码省略.........
示例8: getMyDatabases
private TreeNode getMyDatabases(SOA mySOA)
{
int imageIndex = 0;
bool rootYellow=false;
if (mySOA.MyDatabaseServers!=null)
{
for (int i = 0; i < mySOA.MyDatabaseServers.Count; i++)
{
if (mySOA.MyDatabaseServers[i].Status != ConfigUtility.DATABASE_ONLINE)
rootYellow = true;
}
}
if (rootYellow)
imageIndex = 54;
else
imageIndex = 38;
TreeNode root = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">Database Servers</span>", imageIndex.ToString(), imageList[imageIndex]);
if (rootYellow)
root.ToolTip = "Connected Databases - Some Offline!";
else
root.ToolTip = "Connected Databases";
if (mySOA.MyDatabaseServers == null || mySOA.MyDatabaseServers.Count == 0)
return root;
root.Collapse();
imageIndex = 0;
int offset = 0;
TreeNode[] clusterNodes = new TreeNode[mySOA.MyDatabaseServers.Count];
string prefix = "";
for (int i = 0; i < mySOA.MyDatabaseServers.Count; i++)
{
if (mySOA.MyDatabaseServers[i].Edition == null)
{
mySOA.MyDatabaseServers[i].Edition = "Unknown";
mySOA.MyDatabaseServers[i].Version = "Unknown";
}
else
if (mySOA.MyDatabaseServers[i].Edition.ToLower().Contains("azure"))
{
offset = 1;
prefix = "SQL Azure Cloud RDBMS ";
}
else
{
offset = 0;
prefix = "On-Premise SQL Server ";
}
if (mySOA.MyDatabaseServers[i].Status.Equals(ConfigUtility.DATABASE_ONLINE))
imageIndex = 28 + offset;
else
if (mySOA.MyDatabaseServers[i].Status.Equals(ConfigUtility.DATABASE_OFFLINE))
imageIndex = 30 + offset;
else
imageIndex = 32 + offset;
TreeNode dbServer;
if (CheckBoxNoDetail.Checked)
{
dbServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDatabaseServers[i].ServerName + "</span>", imageIndex.ToString(), imageList[imageIndex]);
}
else
{
dbServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDatabaseServers[i].ServerName + " : " + mySOA.MyDatabaseServers[i].Edition + " : " + mySOA.MyDatabaseServers[i].Version + "</span>", imageIndex.ToString(), imageList[imageIndex]);
}
dbServer.ToolTip = mySOA.MyDatabaseServers[i].Exception;
dbServer.Collapse();
TreeNode[] databases = new TreeNode[mySOA.MyDatabaseServers[i].MyDatabases.Count];
for (int j = 0; j < mySOA.MyDatabaseServers[i].MyDatabases.Count; j++)
{
if (mySOA.MyDatabaseServers[i].MyDatabases[j].Edition == null)
{
mySOA.MyDatabaseServers[i].MyDatabases[j].Edition = "Unknown";
}
if (mySOA.MyDatabaseServers[i].MyDatabases[j].Edition.ToLower().Contains("azure"))
offset = 1;
else
offset = 0;
switch (mySOA.MyDatabaseServers[i].MyDatabases[j].Status)
{
case ConfigUtility.DATABASE_ONLINE: { imageIndex = 34 + offset; break; }
case ConfigUtility.DATABASE_OFFLINE: { imageIndex = 36 + offset; break; }
default: { imageIndex = 36 + offset; break; }
}
//the most likely cause of not having data here is that the user does not permissions for stats on SQL Server. For the detailed query stats, you need the login user to be in an admin role or some sort.
//For ConfigWeb, the config administrator needs to be granted these permissions on a per database case; if desired. If not desired,
//you just will get no additional info.
databases[j] = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">" + mySOA.MyDatabaseServers[i].MyDatabases[j].DatabaseName + " : Size= </span><span style=\"Color:#6B8EAA;\">" + (mySOA.MyDatabaseServers[i].MyDatabases[j].DatabaseSize*1000f).ToString() + " (MB)</span>", imageIndex.ToString(), imageList[imageIndex]);
databases[j].ToolTip = mySOA.MyDatabaseServers[i].MyDatabases[j].Exception;
TreeNode[] queries = new TreeNode[5];
TreeNode latency = new TreeNode("<span style=\"color:#63553D;\">Latency to SQL Database ms: " + mySOA.MyDatabaseServers[i].MyDatabases[j].Latency.ToString() + "</span>", "42", imageList[42]);
latency.ToolTip = "The amount of time in ms to execute a simple query and retrieve the single row-result set from the remote SQL database. Note that service-domains co-located with their SQL Azure databases in the same Azure region will typically have lower latency on database calls.";
queries[0] = latency;
databases[j].ChildNodes.Add(queries[0]);
//top slowest first.
if (mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime != null)
{
TreeNode topSlowSQL = new TreeNode("<span style=\"color:#63553D;\">Top " + mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime.Count.ToString() + " Slowest SQL Statements</span>", "39", imageList[39]);
topSlowSQL.ToolTip = "The slowest n queries as returned by SQL Server Dynamic Management View statistics. Pay attention to the number of times executed, and the last vs. Avg completion time. A database beginning to approach capacity (CPU and/or IO) will show an increasing last-exec time deviation from avg-exec time. You can easily adjust the number of queries shown using ConfigWeb.";
TreeNode[] sqlData0;
for (int queryslowestcount = 0; queryslowestcount < mySOA.MyDatabaseServers[i].MyDatabases[j].TopWorstByExecTime.Count; queryslowestcount++)
{
//.........这里部分代码省略.........
示例9: getMyDistributedCaches
private TreeNode getMyDistributedCaches(SOA mySOA)
{
bool rootYellow = false;
if (mySOA.MyDistributedCaches != null)
{
for (int i = 0; i < mySOA.MyDistributedCaches.Count; i++)
{
if (mySOA.MyDistributedCaches[i].Status != ConfigUtility.DISTRIBUTED_CACHE_ONLINE)
rootYellow = true;
}
}
int imageIndex = 0;
if (rootYellow)
imageIndex = 53;
else
imageIndex = 49;
TreeNode root = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">Distributed Caches</span>", imageIndex.ToString(), imageList[imageIndex]);
if (rootYellow)
root.ToolTip = "Distributed Caches - Some Offline!";
else
root.ToolTip = "Distributed Caches";
if (mySOA.MyDistributedCaches == null || mySOA.MyDistributedCaches.Count == 0)
return root;
root.Collapse();
imageIndex=0;
int offset = 0;
TreeNode[] clusterNodes = new TreeNode[mySOA.MyDistributedCaches.Count];
string prefix = "";
for (int i = 0; i < mySOA.MyDistributedCaches.Count; i++)
{
if (mySOA.MyDistributedCaches[i].Status == null)
{
mySOA.MyDistributedCaches[i].Status = "Unknown";
}
else
if (mySOA.MyDistributedCaches[i].CacheServers!=null && mySOA.MyDistributedCaches[i].CacheServers.Count != 0)
{
if (mySOA.MyDistributedCaches[i].CacheServers[0].ServerName.ToLower().Contains("windows.net"))
{
offset = 1;
prefix = "Windows Azure AppFabric ";
}
else
{
offset = 0;
prefix = "Windows Server AppFabric ";
}
}
if (mySOA.MyDistributedCaches[i].Status.Equals(ConfigUtility.DISTRIBUTED_CACHE_ONLINE))
imageIndex = 43 + offset;
else
if (mySOA.MyDistributedCaches[i].Status.Equals(ConfigUtility.DISTRIBUTED_CACHE_OFFLINE))
{
imageIndex = 45 + offset;
}
else
{
imageIndex = 47 + offset;
}
TreeNode cacheServer;
if (CheckBoxNoDetail.Checked)
{
cacheServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDistributedCaches[i].Name + "</span>", imageIndex.ToString(), imageList[imageIndex]);
}
else
{
cacheServer = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px\">" + prefix + mySOA.MyDistributedCaches[i].Name + "</span>", imageIndex.ToString(), imageList[imageIndex]);
}
cacheServer.ToolTip = mySOA.MyDistributedCaches[i].Exception;
cacheServer.Collapse();
TreeNode[] cacheservers = new TreeNode[mySOA.MyDistributedCaches[i].CacheServers.Count];
TreeNode latencyLocal = new TreeNode("<span style=\"color:#63553D;\">Latency for Client Local Cache Get ms: " + mySOA.MyDistributedCaches[i].LocalCacheLatency.ToString() + "</span>", "42", imageList[42]);
TreeNode latencyDistributed = new TreeNode("<span style=\"color:#63553D;\">Latency for Client Distributed Cache Get ms: " + mySOA.MyDistributedCaches[i].DistributedCacheLatency.ToString() + "</span>", "42", imageList[42]);
latencyLocal.ToolTip = "The amount of time in ms to pull from the in-memory local cache a 3K custom object that exists in the local cache, inclusive of deserialization time. Since the test object exists in the local cache, a network request to the distributed cache cluster is not necessary and is not performed by the AppFabric cache client.";
latencyDistributed.ToolTip = "The amount of time in ms to pull from the distributed cache cluster a 3K custom object. This is inclusive of the remote network call, and deserialization time. The cache client is gauranteed to make a distributed network call on this request, as the local cache will not contain the test object.";
if (offset == 1)
imageIndex = 5;
else
imageIndex = 13;
for (int j = 0; j < mySOA.MyDistributedCaches[i].CacheServers.Count; j++)
{
if (mySOA.MyDistributedCaches[i].CacheServers[j].ServerName == null || mySOA.MyDistributedCaches[i].CacheServers[j].ServerName == "")
break;
cacheservers[j] = new TreeNode("<span style=\"color:#8D7A59;padding-left:10px;\">" + mySOA.MyDistributedCaches[i].CacheServers[j].ServerName + ":" + mySOA.MyDistributedCaches[i].CacheServers[j].Port.ToString(), imageIndex.ToString(), imageList[imageIndex]);
if (imageIndex == 5)
cacheservers[j].ToolTip = "Windows Azure AppFabric Cache Namespace: Multiple Servers Service This Cache Behind Azure AppFabric Load Balancer";
else
cacheservers[j].ToolTip = "Windows Server AppFabric Cache Host";
}
if (mySOA.MyDistributedCaches[i].Status == ConfigUtility.DISTRIBUTED_CACHE_ONLINE)
{
cacheServer.ChildNodes.Add(latencyDistributed);
cacheServer.ChildNodes.Add(latencyLocal);
}
if (cacheservers != null)
{
for (int nodecount = 0; nodecount < cacheservers.Length; nodecount++)
{
cacheServer.ChildNodes.Add(cacheservers[nodecount]);
}
//.........这里部分代码省略.........
示例10: AddAgentsRecursively
/*
* We need to pass in 2 nodes here, since the Groups tree is different from the agents tree
* The nAgents will contain users in addition to group members.
* nGroups will only contain members that are groups.
*/
private void AddAgentsRecursively(TreeNode nAgents, TreeNode nGroups)
{
try
{
if (nAgents.ImageUrl.CompareTo(userImage) != 0)// Do not process if it is a user
{
int groupID = Convert.ToInt32(nAgents.Value);
//Should Filter by Wrapper
IntTag[] userTags = brokerDB.GetIntTags("Group_RetrieveUserTags",
FactoryDB.CreateParameter("@groupID", groupID, DbType.Int32));
Group[] groups = AdministrativeAPI.GetGroups(
brokerDB.GetInts("Group_RetrieveChildrenGroupIDs",
FactoryDB.CreateParameter("@groupID", groupID, DbType.Int32)).ToArray());
//int[] childUserIDs = wrapper.ListUserIDsInGroupWrapper(Convert.ToInt32(nAgents.Value));
//int[] childGroupIDs = wrapper.ListSubgroupIDsWrapper(Convert.ToInt32(nAgents.Value));
//User[] usersList = wrapper.GetUsersWrapper(childUserIDs);
//List<User> childUsersList = new List<User>();
//childUsersList.AddRange(usersList);
//childUsersList.Sort();
//Group[] groupsList = wrapper.GetGroupsWrapper(childGroupIDs);
//List<Group> childGroupsList = new List<Group>();
//childGroupsList.AddRange(groupsList);
//childGroupsList.Sort();
foreach (IntTag u in userTags)
{
TreeNode childNode = new TreeNode(u.tag, u.id.ToString(), userImage);
//childNode.Status = 1;
childNode.ShowCheckBox = true;
childNode.SelectAction = TreeNodeSelectAction.None;
childNode.Expanded = false;
nAgents.ChildNodes.Add(childNode);
}
if (groups == null || groups.Length < 1)
{
nAgents.Expanded = false;
}
foreach (Group g in groups)
{
if (g.groupID > 0)
{
TreeNode childNode = new TreeNode(g.groupName, g.groupID.ToString(), groupImage);
childNode.SelectAction = TreeNodeSelectAction.None;
childNode.ShowCheckBox = isRegular(g);
childNode.Collapse();
TreeNode groupChildNode = new TreeNode(g.groupName, g.groupID.ToString(), groupImage);
groupChildNode.ShowCheckBox = true;
groupChildNode.SelectAction = TreeNodeSelectAction.None;
this.AddAgentsRecursively(childNode, groupChildNode);
nAgents.ChildNodes.Add(childNode);
nGroups.ChildNodes.Add(groupChildNode);
}
}
}
}
catch (Exception ex)
{
lblResponse.Text = Utilities.FormatErrorMessage("Cannot list users and groups. "+ex.GetBaseException());
lblResponse.Visible = true;
}
}
示例11: PopulateTreeView
int PopulateTreeView(CategoryElements parentCategory, int curentPosition, TreeNode parentNode)
{
// parentTag.hierarchicalPosition = curentPosition;
int j = 0;
foreach (CategoryElements category in categoryMap)
{
if (category.parentName == parentCategory.categoryName)
{
TreeNode curentNode = new TreeNode();
curentNode.Text = category.categoryName;
curentNode.NavigateUrl = "CategoriesMap.aspx?category=" + category.categoryName;
curentNode.Collapse();
parentNode.ChildNodes.Add(curentNode);
PopulateTreeView(category, curentPosition + 1, curentNode);
}
j++;
// Response.Write(tag.tagName + " " + tag.parentName + "<br />");
}
return 0;
}
示例12: PopulateCategories
void PopulateCategories()
{
SqlCommand sqlQuery = new SqlCommand(
"Select Cat_ID, CatName from TB_Cat_Product");
DataSet resultSet;
resultSet = RunQuery(sqlQuery);
if (resultSet.Tables.Count > 0)
{
foreach (DataRow row in resultSet.Tables[0].Rows)
{
TreeNode NewNode = new
TreeNode(row["CatName"].ToString(),
row["Cat_ID"].ToString());
//NewNode.PopulateOnDemand = true;
if (row["Cat_ID"].ToString().Equals(StrCatID) && !string.IsNullOrEmpty(StrCatID))
{
NewNode.Expand();
}
else
{
NewNode.Collapse();
}
NewNode.SelectAction = TreeNodeSelectAction.Expand;
PopulateSubCategories(NewNode);
//node.ChildNodes.Add(NewNode);
TreeView1.Nodes.Add(NewNode);
}
}
}