本文整理匯總了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);
}