SiteMapNode.ToString Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Converts the value of this instance of the SiteMapNode class to its equivalent string representation.
public:
override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String
Returns
The string representation of the value of this SiteMapNode.
Examples
The following code example demonstrates how to compare the ToString method to the Url and Title properties of a SiteMapNode object.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
// Navigate the SiteMap built by the default SiteMapProvider.
Response.Write(SiteMap.RootNode.ToString() + "<BR>");
Response.Write(SiteMap.RootNode.Url + "<BR>");
Response.Write(SiteMap.RootNode.Title + "<BR>");
foreach (SiteMapNode sitemapnode in SiteMap.RootNode.ChildNodes)
{
// Iterate through the ChildNodes SiteMapNodesCollection
// maintained by the RootNode.
Response.Write(sitemapnode.Url + "<BR>" );
}
IEnumerator providers = SiteMap.Providers.GetEnumerator();
while (providers.MoveNext())
{
Response.Write(providers.Current);
Response.Write(" ");
Response.Write("<BR>");
}
}
</SCRIPT>
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<SCRIPT runat="server">
Private Sub Page_Load(Sender As Object, E As EventArgs)
' Navigate the SiteMap built by the default SiteMapProvider.
Response.Write(SiteMap.RootNode.ToString() & "<BR>")
Response.Write(SiteMap.RootNode.Url & "<BR>")
Response.Write(SiteMap.RootNode.Title & "<BR>")
Dim sitemapnode As SiteMapNode
For Each sitemapnode In SiteMap.RootNode.ChildNodes
' Iterate through the ChildNodes SiteMapNodesCollection
' maintained by the RootNode.
Response.Write(sitemapnode.Url & "<BR>" )
Next
Dim providers As IDictionaryEnumerator = SiteMap.Providers.GetEnumerator()
While (providers.MoveNext())
Response.Write(providers.Current)
Response.Write(" ")
Response.Write("<BR>")
End While
End Sub ' Page_Load
</SCRIPT>
Remarks
The ToString method returns the Title property of a SiteMapNode object.
Applies to
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET