SPNavigationNode.Title Property

Gets or sets the string that is used as the anchor text for the node navigation link.

Namespace:  Microsoft.SharePoint.Navigation
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.NotNull)> _
<ClientCallableAttribute> _
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.MaxLength, Value := )> _
Public Property Title As String
    Get
    Set
'Usage
Dim instance As SPNavigationNode
Dim value As String

value = instance.Title

instance.Title = value
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.NotNull)]
[ClientCallableAttribute]
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.MaxLength, Value = )]
public string Title { get; set; }

Property Value

Type: System.String
A string representing the display name that serves as anchor text.

Remarks

The value that is returned can vary depending on the current thread's Thread.CurrentUICulture property. For more information, see the TitleResource property.

Examples

The following example is a console application that iterates through the list of cultures supported by a Web site and sets the current thread's CurrentUICulture to each one, in turn. For each supported culture, the application prints the name of the culture and the value of the Title property in that culture.

using System;
using System.Globalization;
using System.Threading;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Navigation;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("https://localhost"))
            {
                using (SPWeb web = site.RootWeb)
                {
                    string formatString = "{0, -20} {1}";
                    Console.WriteLine(formatString, "CurrentUICulture","Title");

                    SPNavigationNode home = web.Navigation.Home;

                    foreach (CultureInfo culture in web.SupportedUICultures)
                    {
                        Thread.CurrentThread.CurrentUICulture = culture;
                        Console.WriteLine(formatString, culture.Name, home.Title);
                    }
                }
            }
            Console.Write("\nPress ENTER to continue....");
            Console.Read();
        }
    }
}
Imports System
Imports System.Globalization
Imports System.Threading
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Navigation

Module ConsoleApp

    Sub Main()
        Using site As New SPSite("https://localhost")
            Using web As SPWeb = site.OpenWeb()

                Dim formatString As String = "{0, -20} {1}"
                Console.WriteLine(formatString, "CurrentUICulture", "Title")

                Dim home As SPNavigationNode = web.Navigation.Home

                For Each culture As CultureInfo In web.SupportedUICultures
                    Thread.CurrentThread.CurrentUICulture = culture
                    Console.WriteLine(formatString, culture.Name, home.Title)
                Next

            End Using
        End Using
        Console.Write(vbCrLf & "Press ENTER to continue....")
        Console.Read()
    End Sub

End Module

See Also

Reference

SPNavigationNode Class

SPNavigationNode Members

Microsoft.SharePoint.Navigation Namespace

TitleResource