Bagikan melalui


SiteMapPath.PathSeparatorTemplate Properti

Definisi

Mendapatkan atau mengatur templat kontrol yang akan digunakan untuk pembatas jalur jalur jalur navigasi situs.

public:
 virtual property System::Web::UI::ITemplate ^ PathSeparatorTemplate { System::Web::UI::ITemplate ^ get(); void set(System::Web::UI::ITemplate ^ value); };
[System.ComponentModel.Browsable(false)]
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
[System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.SiteMapNodeItem))]
public virtual System.Web.UI.ITemplate PathSeparatorTemplate { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.SiteMapNodeItem))>]
member this.PathSeparatorTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property PathSeparatorTemplate As ITemplate

Nilai Properti

Objek ITemplate yang mengimplementasikan InstantiateIn(Control) metode , untuk merender konten kustom untuk pemisah jalur jalur navigasi.

Atribut

Contoh

Contoh kode berikut menunjukkan cara mendefinisikan Image sebagai PathSeparatorTemplate secara deklaratif dalam Formulir Web.

<%@ Page language="c#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>About Us</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">
      <asp:SiteMapPath
          runat="server"
          ID="SiteMapPath1"
          RootNodeStyle-Font-Names="Verdana"
          RootNodeStyle-Font-Italic="True"
          RootNodeStyle-ForeColor="Blue"
          CurrentNodeStyle-ForeColor="Red">
          <PATHSEPARATORTEMPLATE>
              <asp:Image id="Image1" runat="server" 
                GenerateEmptyAlternateText="true" 
                ImageUrl="6.jpg"></asp:Image>
          </PATHSEPARATORTEMPLATE>
        </asp:SiteMapPath>
        <h1>About Us</h1>
      <p>This company was founded in 1899, as the demand for widgets grew.</p>
    </form>
  </body>
</html>
<%@ Page language="VB"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>About Us</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">
      <asp:SiteMapPath
          runat="server"
          ID="SiteMapPath1"
          RootNodeStyle-Font-Names="Verdana"
          RootNodeStyle-Font-Italic="True"
          RootNodeStyle-ForeColor="Blue"
          CurrentNodeStyle-ForeColor="Red">
          <PATHSEPARATORTEMPLATE>
              <asp:Image id="Image1" runat="server" 
                GenerateEmptyAlternateText="true" 
                ImageUrl="6.jpg"></asp:Image>
          </PATHSEPARATORTEMPLATE>
        </asp:SiteMapPath>
        <h1>About Us</h1>
      <p>This company was founded in 1899, as the demand for widgets grew.</p>
    </form>
  </body>
</html>

Keterangan

PathSeparatorTemplate Atur ke ITemplate objek untuk menggunakan Image atau beberapa kontrol lain, seperti , sebagai Labelpemisah jalur antara simpul navigasi, bukan PathSeparator string.

PathSeparatorTemplate Jika properti diatur, templat akan mengambil alih teks yang PathSeparator ditampilkan dan apa pun PathSeparatorStyle yang diterapkan padanya.

Anda dapat secara deklaratif mengatur PathSeparatorTemplate properti ke kontrol server Web apa pun, dan infrastruktur ASP.NET melakukan langkah-langkah yang diperlukan untuk membungkus kontrol server Web sebagai ITemplate. Namun, kontrol server Web tidak mengimplementasikan ITemplate antarmuka; oleh karena itu, ketika Anda bekerja dengan ITemplate properti secara terprogram, Anda harus menulis pembungkus ITemplate untuk kode templat apa pun. Kemudian, PathSeparatorTemplate properti diatur ke instans ITemplate pembungkus.

Berlaku untuk

Lihat juga