SiteMapNode 생성자

정의

SiteMapNode 클래스의 새 인스턴스를 초기화하여 지정된 SiteMapProvider 개체와 연결합니다.

오버로드

SiteMapNode(SiteMapProvider, String)

노드에서 나타내는 페이지를 식별하는 지정된 key와 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

SiteMapNode(SiteMapProvider, String, String)

지정된 URL, 노드에서 나타내는 페이지를 식별하는 key 및 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

SiteMapNode(SiteMapProvider, String, String, String)

지정된 URL, 노드에서 나타내는 페이지를 식별하는 key, 제목 및 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

SiteMapNode(SiteMapProvider, String, String, String, String)

지정된 URL, 노드에서 나타내는 페이지를 식별하는 key, 제목과 설명 및 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

SiteMapNode(SiteMapProvider, String, String, String, String, IList, NameValueCollection, NameValueCollection, String)

노드, URL, 제목, 설명, 역할, 추가 특성 및 지역화를 위한 명시적 및 암시적 리소스 키를 관리하는 지정된 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

SiteMapNode(SiteMapProvider, String)

노드에서 나타내는 페이지를 식별하는 지정된 key와 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

public:
 SiteMapNode(System::Web::SiteMapProvider ^ provider, System::String ^ key);
public SiteMapNode (System.Web.SiteMapProvider provider, string key);
new System.Web.SiteMapNode : System.Web.SiteMapProvider * string -> System.Web.SiteMapNode
Public Sub New (provider As SiteMapProvider, key As String)

매개 변수

provider
SiteMapProvider

노드가 연결된 SiteMapProvider입니다.

key
String

공급자별 조회 키입니다.

예외

SiteMapProvidernull입니다.

또는

key이(가) null인 경우

설명

XmlSiteMapProvider 기본 클래스 SiteMapProvider ASP.NET에 대 한 공급자 구현을 사용 하 여는 SiteMapNode.Url (URL을 지정 하지 않으면 추적 식별자는 노드에 대 한 생성) 하는 경우 노드에 제공 되는 경우 조회 키로는 속성입니다. 따라서 SiteMapNode URL을 제공 하 고 사용 되는 컨트롤을 XmlSiteMapProvider 공급자의 범위 내에서 고유한 URL을 사용 해야 합니다.

적용 대상

SiteMapNode(SiteMapProvider, String, String)

지정된 URL, 노드에서 나타내는 페이지를 식별하는 key 및 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

public:
 SiteMapNode(System::Web::SiteMapProvider ^ provider, System::String ^ key, System::String ^ url);
public SiteMapNode (System.Web.SiteMapProvider provider, string key, string url);
new System.Web.SiteMapNode : System.Web.SiteMapProvider * string * string -> System.Web.SiteMapNode
Public Sub New (provider As SiteMapProvider, key As String, url As String)

매개 변수

provider
SiteMapProvider

노드가 연결된 SiteMapProvider입니다.

key
String

공급자별 조회 키입니다.

url
String

노드에서 사이트 내에 나타내는 페이지의 URL입니다.

예외

SiteMapProvider이(가) null인 경우

또는

key이(가) null인 경우

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 SiteMapNodeCollection 새 생성자 SiteMapNodeCollection 컬렉션을 추가한 다음 요소를 사용 하 여를 Add 메서드.

// 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;
}
' 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

설명

XmlSiteMapProvider 기본 클래스 SiteMapProvider ASP.NET에 대 한 공급자 구현을 사용 하 여는 SiteMapNode.Url (URL을 지정 하지 않으면 추적 식별자는 노드에 대 한 생성) 하는 경우 노드에 제공 되는 경우 조회 키로는 속성입니다. 따라서 SiteMapNode URL을 제공 하 고 사용 되는 개체는 XmlSiteMapProvider 공급자의 범위 내에서 고유한 URL을 사용 해야 합니다.

적용 대상

SiteMapNode(SiteMapProvider, String, String, String)

지정된 URL, 노드에서 나타내는 페이지를 식별하는 key, 제목 및 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

public:
 SiteMapNode(System::Web::SiteMapProvider ^ provider, System::String ^ key, System::String ^ url, System::String ^ title);
public SiteMapNode (System.Web.SiteMapProvider provider, string key, string url, string title);
new System.Web.SiteMapNode : System.Web.SiteMapProvider * string * string * string -> System.Web.SiteMapNode
Public Sub New (provider As SiteMapProvider, key As String, url As String, title As String)

매개 변수

provider
SiteMapProvider

노드가 연결된 SiteMapProvider입니다.

key
String

공급자별 조회 키입니다.

url
String

노드에서 사이트 내에 나타내는 페이지의 URL입니다.

title
String

주로 탐색 컨트롤에서 표시하는 노드의 레이블입니다.

예외

SiteMapProvider이(가) null인 경우

또는

key이(가) null인 경우

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 SiteMapNode 의 새 인스턴스를 만들려면 생성자를 SiteMapNode 클래스. 노드는 Microsoft Access 데이터베이스 행의 값으로 초기화 됩니다.

이 코드 예제는에 대해 제공 된 큰 예제의 일부는 BuildSiteMap 메서드.

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();

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();
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()

설명

XmlSiteMapProvider 기본 클래스 SiteMapProvider ASP.NET에 대 한 공급자 구현을 사용 하 여는 SiteMapNode.Url (URL을 지정 하지 않으면 추적 식별자는 노드에 대 한 생성) 하는 경우 노드에 제공 되는 경우 조회 키로는 속성입니다. 따라서 SiteMapNode URL을 제공 하 고 사용 되는 개체는 XmlSiteMapProvider 공급자의 범위 내에서 고유한 URL을 사용 해야 합니다.

없으면 title 제공, 호출 하는 Title 속성을 반환 합니다 String.Empty 필드.

적용 대상

SiteMapNode(SiteMapProvider, String, String, String, String)

지정된 URL, 노드에서 나타내는 페이지를 식별하는 key, 제목과 설명 및 노드를 관리하는 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

public:
 SiteMapNode(System::Web::SiteMapProvider ^ provider, System::String ^ key, System::String ^ url, System::String ^ title, System::String ^ description);
public SiteMapNode (System.Web.SiteMapProvider provider, string key, string url, string title, string description);
new System.Web.SiteMapNode : System.Web.SiteMapProvider * string * string * string * string -> System.Web.SiteMapNode
Public Sub New (provider As SiteMapProvider, key As String, url As String, title As String, description As String)

매개 변수

provider
SiteMapProvider

노드가 연결된 SiteMapProvider입니다.

key
String

공급자별 조회 키입니다.

url
String

노드에서 사이트 내에 나타내는 페이지의 URL입니다.

title
String

주로 탐색 컨트롤에서 표시하는 노드의 레이블입니다.

description
String

노드에서 나타내는 페이지의 설명입니다.

예외

SiteMapProvider이(가) null인 경우

또는

key이(가) null인 경우

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 SiteMapNode 만드는 생성자입니다는 SiteMapNode 메모리에서 사이트 맵을 빌드하는 간단한 텍스트 파일에서 데이터를 구문 분석 하 여 개체입니다.

이 코드 예제는 추상에 대해 제공 된 큰 예제의 일부 SiteMapProvider 클래스입니다.

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 &&
                string.IsNullOrEmpty(nodeValues[3]))
            {
              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;
}
  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
End Class

설명

XmlSiteMapProvider 기본 클래스 SiteMapProvider ASP.NET에 대 한 공급자 구현을 사용 하 여는 SiteMapNode.Url (URL을 지정 하지 않으면 추적 식별자는 노드에 대 한 생성) 하는 경우 노드에 제공 되는 경우 조회 키로는 속성입니다. 따라서 SiteMapNode URL을 제공 하 고 사용 되는 개체는 XmlSiteMapProvider 공급자의 범위 내에서 고유한 URL을 사용 해야 합니다.

없으면 title 또는 description 제공, 호출 하는 Title 또는 Description 속성 반환을 String.Empty 필드입니다.

추가 정보

적용 대상

SiteMapNode(SiteMapProvider, String, String, String, String, IList, NameValueCollection, NameValueCollection, String)

노드, URL, 제목, 설명, 역할, 추가 특성 및 지역화를 위한 명시적 및 암시적 리소스 키를 관리하는 지정된 사이트 맵 공급자를 사용하여 SiteMapNode 클래스의 새 인스턴스를 초기화합니다.

public:
 SiteMapNode(System::Web::SiteMapProvider ^ provider, System::String ^ key, System::String ^ url, System::String ^ title, System::String ^ description, System::Collections::IList ^ roles, System::Collections::Specialized::NameValueCollection ^ attributes, System::Collections::Specialized::NameValueCollection ^ explicitResourceKeys, System::String ^ implicitResourceKey);
public SiteMapNode (System.Web.SiteMapProvider provider, string key, string url, string title, string description, System.Collections.IList roles, System.Collections.Specialized.NameValueCollection attributes, System.Collections.Specialized.NameValueCollection explicitResourceKeys, string implicitResourceKey);
new System.Web.SiteMapNode : System.Web.SiteMapProvider * string * string * string * string * System.Collections.IList * System.Collections.Specialized.NameValueCollection * System.Collections.Specialized.NameValueCollection * string -> System.Web.SiteMapNode
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)

매개 변수

provider
SiteMapProvider

노드가 연결된 SiteMapProvider입니다.

key
String

공급자별 조회 키입니다.

url
String

노드에서 사이트 내에 나타내는 페이지의 URL입니다.

title
String

주로 탐색 컨트롤에서 표시하는 노드의 레이블입니다.

description
String

노드에서 나타내는 페이지의 설명입니다.

roles
IList

IList에서 나타내는 페이지를 볼 수 있는 역할의 SiteMapNode입니다.

attributes
NameValueCollection

NameValueCollection를 초기화하는 데 사용되는 추가 특성의 SiteMapNode입니다.

explicitResourceKeys
NameValueCollection

지역화에 사용되는 명시적 리소스 키의 NameValueCollection입니다.

implicitResourceKey
String

지역화에 사용되는 암시적 리소스 키입니다.

예외

SiteMapProvidernull입니다.

또는

key이(가) null인 경우

설명

XmlSiteMapProvider 기본 클래스 SiteMapProvider ASP.NET에 대 한 공급자 구현을 사용 하 여는 SiteMapNode.Url (URL을 지정 하지 않으면 추적 식별자는 노드에 대 한 생성) 하는 경우 노드에 제공 되는 경우 조회 키로는 속성입니다. 따라서 SiteMapNode URL을 제공 하 고 사용 되는 개체는 XmlSiteMapProvider 공급자의 범위 내에서 고유한 URL을 사용 해야 합니다.

NameValueCollection 는 특성의 컬렉션을 SiteMapNode 만들어집니다를 통해 사용할 수 있습니다는 Attributes 속성을 사용 하면 사이트에 특성 추가 적용 하기가 쉽습니다 매핑 노드를 확장 하 고 사용자 지정 클래스를 파생 하지 않고 이렇게 합니다.

제공을 IList 노드를 볼 수 있는 역할 집합을 제공 하는 역할의 컬렉션 때 합니다 SecurityTrimmingEnabled 속성이 반환 true. 자세한 내용은 SecurityTrimmingEnabled를 참조하세요.

합니다 XmlSiteMapProvider 공급자가 사용 하는 SiteMapNode.Url 속성을 조회 키로 합니다. 따라서 SiteMapNode 에서 사용 되는 XmlSiteMapProvider 공급자의 범위 내에서 고유한 URL을 사용 해야 합니다.

없으면 title 또는 description 제공, 호출 하는 Title 또는 Description 속성 반환을 String.Empty 필드입니다.

값을 설정 하거나 프로그래밍 방식으로 지역화를 위한 리소스를 지정 하려면 implicitResourceKey 노드 또는 집합에 대 한 지역화 된 리소스를 식별 하는 데 사용할 고유한 이름으로 explicitResourceKeysNameValueCollection 컬렉션 name/valuename 노드 속성 또는 사용자 지정 지역화 특성 및 value 지역화 값의 노드 속성 또는 사용자 지정 특성을 포함 합니다. 적절 한.resx 파일에서 지역화 된 값을 설정할 수 있습니다. 지역화 하는 방법에 대 한 자세한 내용은 Title, Description와의 모든 사용자 지정 속성을 SiteMapNode 개체를 참조 하십시오 하는 방법: 지역화 사이트 맵 데이터. 구문 요구 사항에 대 한 합니다 explicitResourceKeys 컬렉션에 참조 NameValueCollection합니다.

추가 정보

적용 대상