SiteMapPath.PathSeparator Property
Assembly: System.Web (in system.web.dll)
[LocalizableAttribute(true)] public: virtual property String^ PathSeparator { String^ get (); void set (String^ value); }
/** @property */ public String get_PathSeparator () /** @property */ public void set_PathSeparator (String value)
public function get PathSeparator () : String public function set PathSeparator (value : String)
Property Value
A string that represents the delimiter for the nodes in a navigation path. The default is " > ", which is a character pointing from left to right, and corresponds to the default PathDirection, which is set to RootToCurrent.If the PathSeparatorStyle is defined, it is applied to the PathSeparator property. However, if a PathSeparatorTemplate property is defined, both the PathSeparator and PathSeparatorStyle properties are ignored.
The value of this property is stored in view state.
The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see LocalizableAttribute and ASP.NET Globalization and Localization.
| Topic | Location |
|---|---|
| How to: Customize the Appearance of SiteMapPath Web Server Controls | Building ASP .NET Web Applications |
| How to: Customize the Appearance of SiteMapPath Web Server Controls | Building ASP .NET Web Applications |
The following example demonstrates how to set the PathSeparator property of a SiteMapPath to a string other than the default.
<%@ Page language="VJ#"%>
<!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)
{
// Create the SiteMapPath control.
SiteMapPath navpath = new SiteMapPath();
// Make the root node look unique.
// The Image that you can use in your Web page is an
// instance of the WebControls.Image class, not the
// Drawing.Image class.
System.Web.UI.WebControls.Image rootNodeImage = new System.Web.UI.WebControls.Image();
rootNodeImage.set_ImageUrl("myimage.jpg");
ImageTemplate rootNodeImageTemplate = new ImageTemplate();
rootNodeImageTemplate.set_myImage(rootNodeImage);
navpath.set_RootNodeTemplate(rootNodeImageTemplate);
// Make the current node look unique.
Style currentNodeStyle = new Style();
navpath.get_CurrentNodeStyle().set_ForeColor(System.Drawing.Color.get_AliceBlue());
navpath.get_CurrentNodeStyle().set_BackColor(System.Drawing.Color.get_Bisque());
// Set the path separator to be something other
// than the default.
navpath.set_PathSeparator("---->");
PlaceHolder1.get_Controls().Add(navpath);
}
// A simple Template class to wrap an image.
public class ImageTemplate implements ITemplate
{
private System.Web.UI.WebControls.Image myImage;
public System.Web.UI.WebControls.Image get_myImage()
{
return myImage;
}
public void set_myImage(System.Web.UI.WebControls.Image value)
{
myImage = value;
}
public void InstantiateIn(Control container)
{
container.get_Controls().Add(myImage);
}
}
</SCRIPT>
<HTML>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
<h1>About Our Company</h1>
<p>Grandma Fanny founded our company in 1886.</p>
<p>We use only the finest ingredients, organically grown fruits, and
natural spices in our homemade pies. We use no artificial preservatives
or coloring agents. Grandma Fanny would not have it any other way!</p>
</form>
</body>
</HTML>
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
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.