SiteMapPath.NodeTemplate プロパティ

定義

サイト ナビゲーション パスのすべての機能ノードに使用するコントロール テンプレートを取得まはた設定します。

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

プロパティ値

ナビゲーション パスの各ノードのカスタム コンテンツを表示する、ITemplate メソッドを実装した InstantiateIn(Control) オブジェクト。

属性

次のコード例は、 が指定されている場合に、ルート ノードと現在のノードの特殊なスタイルを含め、すべてのノードに定義されているスタイルをオーバーライドする方法 NodeTemplateを示しています。

重要

この例には、ユーザー入力を受け付けるテキスト ボックスがあります。これにより、セキュリティが脆弱になる可能性があります。 既定では、ASP.NET Web ページによって、ユーザー入力にスクリプトまたは 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>
<%@ 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>

注釈

NodeTemplateオブジェクトに をITemplate設定して、 などのLabel他のコントロールを、すべてのナビゲーション パス ノードのユーザー インターフェイス要素として使用Imageします。

プロパティが NodeTemplate 設定されている場合、テンプレートは表示されるナビゲーション ノード テキストと、それに適用されたナビゲーション ノード テキストの NodeStyle 両方をオーバーライドします。 現在のノードとルート ノードの場合、 または RootNodeTemplate が設定されている場合CurrentNodeTemplate、これらのテンプレートは をオーバーライドしますNodeTemplate

プロパティは宣言によって任意の NodeTemplate Web サーバー コントロールに設定でき、ASP.NET インフラストラクチャは Web サーバー コントロールをオブジェクトとしてラップするために必要な手順を ITemplate 実行します。 ただし、Web サーバー コントロールは インターフェイスを ITemplate 実装しないため、プログラムでプロパティを ITemplate 操作する場合は、テンプレート コードのラッパーを記述する ITemplate 必要があります。 次に、 RootNodeTemplate プロパティがラッパーのインスタンスに設定されます ITemplate

適用対象

こちらもご覧ください