SiteMapPath.CurrentNodeTemplate Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur templat kontrol yang akan digunakan untuk simpul jalur navigasi situs yang mewakili halaman yang saat ini ditampilkan.
public:
virtual property System::Web::UI::ITemplate ^ CurrentNodeTemplate { 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 CurrentNodeTemplate { 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.CurrentNodeTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property CurrentNodeTemplate As ITemplate
Nilai Properti
Objek ITemplate yang mengimplementasikan InstantiateIn(Control) metode , untuk merender konten kustom untuk simpul jalur navigasi yang mewakili halaman yang saat ini ditampilkan.
- Atribut
Contoh
Contoh kode berikut secara deklaratif mendefinisikan CurrentNodeTemplate dan mengambil alih yang ditentukan CurrentNodeStyle.
<%@ 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">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<!-- The following example demonstrates some of the orders
of precedence when applying styles and templates to
functional nodes of a SiteMapPath.
The NodeStyle and RootNodeStyle define the same attributes,
but are different and conflict with each other: the
RootNodeStyle supersedes NodeStyle, and is the style
rendered. Notice, however, that the underline style
defined by NodeStyle is still applied.
Both a CurrentNodeStyle and a CurrentNodeTemplate are
defined. A template supersedes a style for a node
type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
is ignored. -->
<asp:SiteMapPath ID="SiteMapPath1" runat="server"
RenderCurrentNodeAsLink="true"
NodeStyle-Font-Names="Franklin Gothic Medium"
NodeStyle-Font-Underline="true"
NodeStyle-Font-Bold="true"
RootNodeStyle-Font-Names="Symbol"
RootNodeStyle-Font-Bold="false"
CurrentNodeStyle-Font-Names="Verdana"
CurrentNodeStyle-Font-Size="10pt"
CurrentNodeStyle-Font-Bold="true"
CurrentNodeStyle-ForeColor="red"
CurrentNodeStyle-Font-Underline="false">
<CURRENTNODETEMPLATE>
<asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
</CURRENTNODETEMPLATE>
</asp:SiteMapPath>
</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">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<!-- The following example demonstrates some of the orders
of precedence when applying styles and templates to
functional nodes of a SiteMapPath.
The NodeStyle and RootNodeStyle define the same attributes,
but are different and conflict with each other: the
RootNodeStyle supersedes NodeStyle, and is the style
rendered. Notice, however, that the underline style
defined by NodeStyle is still applied.
Both a CurrentNodeStyle and a CurrentNodeTemplate are
defined. A template supersedes a style for a node
type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
is ignored. -->
<asp:SiteMapPath ID="SiteMapPath1" runat="server"
RenderCurrentNodeAsLink="true"
NodeStyle-Font-Names="Franklin Gothic Medium"
NodeStyle-Font-Underline="true"
NodeStyle-Font-Bold="true"
RootNodeStyle-Font-Names="Symbol"
RootNodeStyle-Font-Bold="false"
CurrentNodeStyle-Font-Names="Verdana"
CurrentNodeStyle-Font-Size="10pt"
CurrentNodeStyle-Font-Bold="true"
CurrentNodeStyle-ForeColor="red"
CurrentNodeStyle-Font-Underline="false">
<CURRENTNODETEMPLATE>
<asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
</CURRENTNODETEMPLATE>
</asp:SiteMapPath>
</form>
</body>
</html>
Keterangan
CurrentNodeTemplate Atur ke ITemplate objek untuk menggunakan Image kontrol atau beberapa kontrol lain, seperti Label, sebagai elemen antarmuka pengguna simpul saat ini alih-alih string.
CurrentNodeTemplate Jika properti diatur, templat akan mengambil alih teks simpul navigasi saat ini yang ditampilkan dan apa pun CurrentNodeStyle yang diterapkan padanya. Namun, jika halaman yang ditampilkan saat ini sesuai dengan simpul akar, RootNodeTemplate atau RootNodeStyle digunakan.
Anda dapat secara deklaratif mengatur CurrentNodeTemplate properti ke kontrol server Web apa pun, dan infrastruktur ASP.NET melakukan langkah-langkah yang diperlukan untuk membungkus kontrol server Web sebagai ITemplate objek. Namun, kontrol server Web tidak mengimplementasikan ITemplate antarmuka; oleh karena itu, ketika Anda bekerja dengan ITemplate properti secara terprogram, Anda harus menulis ITemplate pembungkus untuk kode templat apa pun. Kemudian, CurrentNodeTemplate properti diatur ke instans pembungkus ITemplate .
Berlaku untuk
Lihat juga
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk