本文整理汇总了C#中System.Web.SiteMapNodeCollection.SiteMapNodeCollection构造函数的典型用法代码示例。如果您正苦于以下问题:C# SiteMapNodeCollection构造函数的具体用法?C# SiteMapNodeCollection怎么用?C# SiteMapNodeCollection使用的例子?那么, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Web.SiteMapNodeCollection
的用法示例。
在下文中一共展示了SiteMapNodeCollection构造函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadSiteMapData
// The LoadSiteMapData() method loads site navigation
// data from persistent storage into a DataTable.
DataTable siteMap = LoadSiteMapData();
// Create a SiteMapNodeCollection.
SiteMapNodeCollection nodes = new SiteMapNodeCollection();
// Create a SiteMapNode and add it to the collection.
SiteMapNode tempNode;
DataRow row;
int index = 0;
while (index < siteMap.Rows.Count)
{
row = siteMap.Rows[index];
// Create a node based on the data in the DataRow.
tempNode = new SiteMapNode(SiteMap.Provider,
row["Key"].ToString(),
row["Url"].ToString());
// Add the node to the collection.
nodes.Add(tempNode);
++index;
}
示例2: SiteMapNodeCollection
// Create a SiteMapNodeCollection with all the nodes
// from the first two hierarchical levels of the current
// site map.
SiteMapNodeCollection baseCollection =
new SiteMapNodeCollection(SiteMap.RootNode);
SiteMapNodeCollection childCollection =
SiteMap.RootNode.ChildNodes;
baseCollection.AddRange(childCollection);
Response.Write( "<BR>Derived SiteMapNodeCollection.<BR><HR><BR>");
foreach (SiteMapNode node in baseCollection) {
Response.Write( node.Title + "<BR>");
}
示例3: if
SiteMapNodeCollection siteNodes = SiteMap.RootNode.GetAllNodes();
if ( siteNodes.IsReadOnly ||
siteNodes.IsFixedSize )
{
Response.Write("Collection is read-only or has fixed size.<BR>");
// Create a new, modifiable collection from the existing one.
SiteMapNodeCollection modifiableCollection =
new SiteMapNodeCollection(siteNodes);
// The MoveNode example method moves a node from position one to
// the last position in the collection.
MoveNode(modifiableCollection);
}
else {
MoveNode(siteNodes);
}