Aracılığıyla paylaş


SiteMapPath.NodeTemplate Özellik

Tanım

Bir site gezinti yolunun tüm işlevsel düğümleri için kullanılacak bir denetim şablonunu alır veya ayarlar.

public:
 virtual property System::Web::UI::ITemplate ^ NodeTemplate { 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 NodeTemplate { 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.NodeTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property NodeTemplate As ITemplate

Özellik Değeri

Bir ITemplate gezinti yolunun InstantiateIn(Control) her düğümü için özel içerik işlemek için yöntemini uygulayan bir nesne.

Öznitelikler

Örnekler

Aşağıdaki kod örneği, bir NodeTemplatetane belirtildiğinde kök düğüm ve geçerli düğüm için özel stiller de dahil olmak üzere tüm düğümler için tanımlanan stilleri nasıl geçersiz kılıp geçersiz kılduğunu gösterir.

Önemli

Bu örnekte, olası bir güvenlik tehdidi olan kullanıcı girişini kabul eden bir metin kutusu vardır. Varsayılan olarak, ASP.NET Web sayfaları kullanıcı girişinin betik veya HTML öğeleri içermediğini doğrular. Daha fazla bilgi için bkz. Betik Açıklarına Genel Bakış.

<%@ 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.

                 A NodeStyle, RootNodeStyle, and CurrentNodeStyle are
                 all defined. However, so is a NodeTemplate. The template
                 is applied to all nodes, and the styles 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">
                <NODETEMPLATE>
                        <asp:CheckBox id="CheckBox1" runat="server" Checked="true" />
                        <asp:TextBox id="TextBox1" runat="server" Text="Declarative template" />
                </NODETEMPLATE>
            </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.

                 A NodeStyle, RootNodeStyle, and CurrentNodeStyle are
                 all defined. However, so is a NodeTemplate. The template
                 is applied to all nodes, and the styles 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">
                <NODETEMPLATE>
                        <asp:CheckBox id="CheckBox1" runat="server" Checked="true" />
                        <asp:TextBox id="TextBox1" runat="server" Text="Declarative template" />
                </NODETEMPLATE>
            </asp:SiteMapPath>


        </form>
    </body>
</html>

Açıklamalar

NodeTemplate öğesini, ITemplate tüm gezinti yolu düğümleri için kullanıcı arabirimi öğesi olarak veya gibi Labelbaşka bir denetimi kullanmak Image üzere bir nesneye ayarlayın.

NodeTemplate Özellik ayarlanırsa, şablon hem görüntülenen gezinti düğümü metnini hem de uygulanan metni NodeStyle geçersiz kılar. Geçerli ve kök düğümler için, veya CurrentNodeTemplateRootNodeTemplate ayarlandıysa, bu şablonlar öğesini NodeTemplategeçersiz kılar.

Özelliği bildirimli olarak herhangi bir Web sunucusu denetimine ayarlayabilirsiniz NodeTemplate ve ASP.NET altyapısı, Web sunucusu denetimini bir ITemplate nesne olarak sarmamak için gerekli adımları gerçekleştirir. Ancak, Web sunucusu denetimleri arabirimini uygulamaz ITemplate ; bu nedenle, özelliklerle ITemplate program aracılığıyla çalışırken, herhangi bir şablon kodu için bir ITemplate sarmalayıcı yazmanız gerekir. Ardından özelliği sarmalayıcının RootNodeTemplateITemplate bir örneğine ayarlanır.

Şunlara uygulanır

Ayrıca bkz.