SiteMapNode コンストラクタ (SiteMapProvider, String, String, String, String)
アセンブリ: System.Web (system.web.dll 内)

Public Sub New ( _ provider As SiteMapProvider, _ key As String, _ url As String, _ title As String, _ description As String _ )
Dim provider As SiteMapProvider Dim key As String Dim url As String Dim title As String Dim description As String Dim instance As New SiteMapNode(provider, key, url, title, description)
public SiteMapNode ( SiteMapProvider provider, string key, string url, string title, string description )
public: SiteMapNode ( SiteMapProvider^ provider, String^ key, String^ url, String^ title, String^ description )
public SiteMapNode ( SiteMapProvider provider, String key, String url, String title, String description )
public function SiteMapNode ( provider : SiteMapProvider, key : String, url : String, title : String, description : String )

例外の種類 | 条件 |
---|---|
ArgumentNullException | SiteMapProvider が null 参照 (Visual Basic では Nothing) です。 または key が null 参照 (Visual Basic では Nothing) です。 |

ASP.NET が既定で実装する SiteMapProvider プロバイダである XmlSiteMapProvider クラスは、SiteMapNode.Url プロパティがノードに対して指定されている場合、それをルックアップ キーとして使用します (URL が指定されない場合は、ノードの追跡 ID が生成されます)。したがって、URL を提供し、XmlSiteMapProvider によって使用されるすべての SiteMapNode オブジェクトには、プロバイダのスコープ内で重複しない URL が割り当てられている必要があります。
title または description の提供がない場合、Title プロパティまたは Description プロパティを呼び出すと String.Empty フィールドが返されます。

SiteMapNode コンストラクタを使用し、簡単なテキスト ファイルからのデータを解析して SiteMapNode オブジェクトを作成し、サイト マップをメモリ内に構築する方法を次のコード例に示します。
このコード例は、SiteMapProvider 抽象クラスのトピックで取り上げているコード例の一部分です。
Protected Overridable Sub LoadSiteMapFromStore() Dim pathToOpen As String SyncLock Me ' If a root node exists, LoadSiteMapFromStore has already ' been called, and the method can return. If Not (aRootNode Is Nothing) Then Return Else pathToOpen = HttpContext.Current.Server.MapPath("~" & "\\" & sourceFilename) If File.Exists(pathToOpen) Then ' Open the file to read from. Dim sr As StreamReader = File.OpenText(pathToOpen) Try ' Clear the state of the collections and aRootNode aRootNode = Nothing siteMapNodes.Clear() childParentRelationship.Clear() ' Parse the file and build the site map Dim s As String = "" Dim nodeValues As String() = Nothing Dim temp As SiteMapNode = Nothing Do s = sr.ReadLine() If Not s Is Nothing Then ' Build the various SiteMapNode objects and add ' them to the ArrayList collections. The format used ' is: URL,TITLE,DESCRIPTION,PARENTURL nodeValues = s.Split(","c) temp = New SiteMapNode(Me, _ HttpRuntime.AppDomainAppVirtualPath & "/" & nodeValues(0), _ HttpRuntime.AppDomainAppVirtualPath & "/" & nodeValues(0), _ nodeValues(1), _ nodeValues(2)) ' Is this a root node yet? If aRootNode Is Nothing AndAlso _ (nodeValues(3) Is Nothing OrElse _ nodeValues(3) = String.Empty) Then aRootNode = temp ' If not the root node, add the node to the various collections. Else siteMapNodes.Add(New DictionaryEntry(temp.Url, temp)) ' The parent node has already been added to the collection. Dim parentNode As SiteMapNode = _ FindSiteMapNode(HttpRuntime.AppDomainAppVirtualPath & "/" & nodeValues(3)) If Not (parentNode Is Nothing) Then childParentRelationship.Add(New DictionaryEntry(temp.Url, parentNode)) Else Throw New Exception("Parent node not found for current node.") End If End If End If Loop Until s Is Nothing Finally sr.Close() End Try Else Throw New Exception("File not found") End If End If End SyncLock Return End Sub 'LoadSiteMapFromStore End Class 'SimpleTextSiteMapProvider
protected virtual void LoadSiteMapFromStore() { string pathToOpen; lock (this) { // If a root node exists, LoadSiteMapFromStore has already // been called, and the method can return. if (rootNode != null) { return; } else { pathToOpen = HttpContext.Current.Server.MapPath("~" + "\\" + sourceFilename); if (File.Exists(pathToOpen)) { // Open the file to read from. using (StreamReader sr = File.OpenText(pathToOpen)) { // Clear the state of the collections and rootNode rootNode = null; siteMapNodes.Clear(); childParentRelationship.Clear(); // Parse the file and build the site map string s = ""; string[] nodeValues = null; SiteMapNode temp = null; while ((s = sr.ReadLine()) != null) { // Build the various SiteMapNode objects and add // them to the ArrayList collections. The format used // is: URL,TITLE,DESCRIPTION,PARENTURL nodeValues = s.Split(','); temp = new SiteMapNode(this, HttpRuntime.AppDomainAppVirtualPath + "/" + nodeValues[0] , HttpRuntime.AppDomainAppVirtualPath + "/" + nodeValues[0] , nodeValues[1], nodeValues[2]); // Is this a root node yet? if (null == rootNode && (null == nodeValues[3] || nodeValues[3] == String.Empty)) { rootNode = temp; } // If not the root node, add the node to the various collections. else { siteMapNodes.Add(new DictionaryEntry(temp.Url, temp)); // The parent node has already been added to the collection. SiteMapNode parentNode = FindSiteMapNode(HttpRuntime.AppDomainAppVirtualPath + "/" + nodeValues[3]); if (parentNode != null) { childParentRelationship.Add(new DictionaryEntry(temp.Url, parentNode)); } else { throw new Exception("Parent node not found for current node."); } } } } } else { throw new Exception("File not found"); } } } return; }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SiteMapNode コンストラクタ (SiteMapProvider, String, String, String)
アセンブリ: System.Web (system.web.dll 内)

Public Sub New ( _ provider As SiteMapProvider, _ key As String, _ url As String, _ title As String _ )
Dim provider As SiteMapProvider Dim key As String Dim url As String Dim title As String Dim instance As New SiteMapNode(provider, key, url, title)
public function SiteMapNode ( provider : SiteMapProvider, key : String, url : String, title : String )

例外の種類 | 条件 |
---|---|
ArgumentNullException | SiteMapProvider が null 参照 (Visual Basic では Nothing) です。 または key が null 参照 (Visual Basic では Nothing) です。 |

ASP.NET が既定で実装する SiteMapProvider プロバイダである XmlSiteMapProvider クラスは、SiteMapNode.Url プロパティがノードに対して指定されている場合、それをルックアップ キーとして使用します (URL が指定されない場合は、ノードの追跡 ID が生成されます)。したがって、URL を提供し、XmlSiteMapProvider によって使用されるすべての SiteMapNode オブジェクトには、プロバイダのスコープ内で重複しない URL が割り当てられている必要があります。

SiteMapNode コンストラクタを使用して SiteMapNode クラスの新しいインスタンスを作成する方法を次のコード例に示します。ノードは、Microsoft Access データベース行から取得した値で初期化されます。
次のコード例は BuildSiteMap メソッドの例の一部です。
Dim rootNodeCommand As New OleDbCommand("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid IS NULL", accessConnection) Dim rootNodeReader As OleDbDataReader = rootNodeCommand.ExecuteReader() If rootNodeReader.HasRows Then rootNodeReader.Read() rootNodeId = rootNodeReader.GetInt32(0) ' Create a SiteMapNode that references the current StaticSiteMapProvider. aRootNode = New SiteMapNode(Me, rootNodeId.ToString(), rootNodeReader.GetString(1), rootNodeReader.GetString(2)) Else Return Nothing End If rootNodeReader.Close()
OleDbCommand rootNodeCommand = new OleDbCommand("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid IS NULL", accessConnection); OleDbDataReader rootNodeReader = rootNodeCommand.ExecuteReader(); if(rootNodeReader.HasRows) { rootNodeReader.Read(); rootNodeId = rootNodeReader.GetInt32(0); // Create a SiteMapNode that references the current StaticSiteMapProvider. rootNode = new SiteMapNode(this, rootNodeId.ToString(), rootNodeReader.GetString(1), rootNodeReader.GetString(2)); } else return null; rootNodeReader.Close();
OleDbCommand^ rootNodeCommand = gcnew OleDbCommand ("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid IS NULL", accessConnection); OleDbDataReader^ rootNodeReader = rootNodeCommand->ExecuteReader(); if ( rootNodeReader->HasRows ) { rootNodeReader->Read(); rootNodeId = rootNodeReader->GetInt32( 0 ); // Create a SiteMapNode that references the current StaticSiteMapProvider. rootNode = gcnew SiteMapNode(this, rootNodeId.ToString(), rootNodeReader->GetString( 1 ),rootNodeReader->GetString( 2 )); } else return nullptr; rootNodeReader->Close();

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SiteMapNode コンストラクタ (SiteMapProvider, String, String)
アセンブリ: System.Web (system.web.dll 内)

Dim provider As SiteMapProvider Dim key As String Dim url As String Dim instance As New SiteMapNode(provider, key, url)

例外の種類 | 条件 |
---|---|
ArgumentNullException | SiteMapProvider が null 参照 (Visual Basic では Nothing) です。 または key が null 参照 (Visual Basic では Nothing) です。 |

ASP.NET が既定で実装する SiteMapProvider プロバイダである XmlSiteMapProvider クラスは、SiteMapNode.Url プロパティがノードに対して指定されている場合、それをルックアップ キーとして使用します (URL が指定されない場合は、ノードの追跡 ID が生成されます)。したがって、URL を提供し、XmlSiteMapProvider によって使用されるすべての SiteMapNode オブジェクトには、プロバイダのスコープ内で重複しない URL が割り当てられている必要があります。

SiteMapNodeCollection コンストラクタを使用して新しい SiteMapNodeCollection コレクションを作成し、Add メソッドを使用してそれに要素を追加する方法を次のコード例に示します。
' The LoadSiteMapData() Function loads site navigation ' data from persistent storage into a DataTable. Dim siteMapData As DataTable siteMapData = LoadSiteMapData() ' Create a SiteMapNodeCollection. Dim nodes As New SiteMapNodeCollection() ' Create a SiteMapNode and add it to the collection. Dim tempNode As SiteMapNode Dim row As DataRow Dim index As Integer index = 0 While (index < siteMapData.Rows.Count) row = siteMapData.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 = index + 1 End While
// 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; }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SiteMapNode コンストラクタ (SiteMapProvider, String, String, String, String, IList, NameValueCollection, NameValueCollection, String)
アセンブリ: System.Web (system.web.dll 内)

Public Sub New ( _ provider As SiteMapProvider, _ key As String, _ url As String, _ title As String, _ description As String, _ roles As IList, _ attributes As NameValueCollection, _ explicitResourceKeys As NameValueCollection, _ implicitResourceKey As String _ )
Dim provider As SiteMapProvider Dim key As String Dim url As String Dim title As String Dim description As String Dim roles As IList Dim attributes As NameValueCollection Dim explicitResourceKeys As NameValueCollection Dim implicitResourceKey As String Dim instance As New SiteMapNode(provider, key, url, title, description, roles, attributes, explicitResourceKeys, implicitResourceKey)
public SiteMapNode ( SiteMapProvider provider, string key, string url, string title, string description, IList roles, NameValueCollection attributes, NameValueCollection explicitResourceKeys, string implicitResourceKey )
public: SiteMapNode ( SiteMapProvider^ provider, String^ key, String^ url, String^ title, String^ description, IList^ roles, NameValueCollection^ attributes, NameValueCollection^ explicitResourceKeys, String^ implicitResourceKey )
public SiteMapNode ( SiteMapProvider provider, String key, String url, String title, String description, IList roles, NameValueCollection attributes, NameValueCollection explicitResourceKeys, String implicitResourceKey )
public function SiteMapNode ( provider : SiteMapProvider, key : String, url : String, title : String, description : String, roles : IList, attributes : NameValueCollection, explicitResourceKeys : NameValueCollection, implicitResourceKey : String )

例外の種類 | 条件 |
---|---|
ArgumentNullException | SiteMapProvider が null 参照 (Visual Basic では Nothing) です。 または key が null 参照 (Visual Basic では Nothing) です。 |

ASP.NET が既定で実装する SiteMapProvider プロバイダである XmlSiteMapProvider クラスは、SiteMapNode.Url プロパティがノードに対して指定されている場合、それをルックアップ キーとして使用します (URL が指定されない場合は、ノードの追跡 ID が生成されます)。したがって、URL を提供し、XmlSiteMapProvider によって使用されるすべての SiteMapNode オブジェクトには、プロバイダのスコープ内で重複しない URL が割り当てられている必要があります。
SiteMapNode の作成に使用する属性の NameValueCollection コレクションは、Attributes プロパティを介して使用できます。この場合、追加属性をサイト マップ ノードに簡単に適用でき、派生カスタム クラスを作成しなくても機能を拡張できます。
SecurityTrimmingEnabled プロパティが true を返した場合、ロールの IList コレクションを提供して、ノードを表示できるロールのセットを提供します。詳細については、「SecurityTrimmingEnabled」を参照してください。
XmlSiteMapProvider プロバイダは SiteMapNode.Url プロパティをルックアップ キーとして使用します。したがって、XmlSiteMapProvider によって使用されるすべての SiteMapNode には、プロバイダのスコープ内で重複しない URL が割り当てられている必要があります。
title または description の提供がない場合、Title プロパティまたは Description プロパティを呼び出すと String.Empty フィールドが返されます。

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


SiteMapNode コンストラクタ

名前 | 説明 |
---|---|
SiteMapNode (SiteMapProvider, String) | SiteMapNode クラスの新しいインスタンスを、ノードが表すページを示す指定した key とノードを管理するサイト マップ プロバイダを使用して初期化します。 |
SiteMapNode (SiteMapProvider, String, String) | SiteMapNode クラスの新しいインスタンスを、指定した URL、ノードが表すページを示す key、およびノードを管理するサイト マップ プロバイダを使用して初期化します。 |
SiteMapNode (SiteMapProvider, String, String, String) | SiteMapNode クラスの新しいインスタンスを、指定した URL、ノードが表すページを示す key、タイトル、およびノードを管理するサイト マップ プロバイダを使用して初期化します。 |
SiteMapNode (SiteMapProvider, String, String, String, String) | SiteMapNode クラスの新しいインスタンスを、指定した URL、ノードが表すページを示す key、タイトルと説明、およびノードを管理するサイト マップ プロバイダを使用して初期化します。 |
SiteMapNode (SiteMapProvider, String, String, String, String, IList, NameValueCollection, NameValueCollection, String) | SiteMapNode クラスの新しいインスタンスを、ノードを管理する指定されたサイト マップ プロバイダ、URL、タイトル、説明、ロール、追加属性、およびローカライズに使用する明示的なリソース キーと暗黙のリソース キーを使用して、初期化します。 |

SiteMapNode コンストラクタ (SiteMapProvider, String)
アセンブリ: System.Web (system.web.dll 内)


例外の種類 | 条件 |
---|---|
ArgumentNullException | SiteMapProvider が null 参照 (Visual Basic では Nothing) です。 または key が null 参照 (Visual Basic では Nothing) です。 |

ASP.NET が既定で実装する SiteMapProvider プロバイダである XmlSiteMapProvider クラスは、SiteMapNode.Url プロパティがノードに対して指定されている場合、それをルックアップ キーとして使用します (URL が指定されない場合は、ノードの追跡 ID が生成されます)。したがって、URL を提供し、XmlSiteMapProvider によって使用されるすべての SiteMapNode コントロールには、プロバイダのスコープ内で重複しない URL が割り当てられている必要があります。

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSiteMapNode コンストラクタを検索する場合は、下記のリンクをクリックしてください。

- SiteMapNode コンストラクタのページへのリンク