다음을 통해 공유


SiteMapPath.CurrentNodeTemplate 속성

정의

현재 표시된 페이지를 나타내는 사이트 탐색 경로의 노드에 사용할 컨트롤 템플릿을 가져오거나 설정합니다.

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

속성 값

현재 표시된 페이지를 나타내는 탐색 경로 노드에 대해 사용자 지정 콘텐츠를 렌더링하기 위해 ITemplate 메서드를 구현하는 InstantiateIn(Control) 개체입니다.

특성

예제

다음 코드 예제에서는 선언적으로 정의 된 CurrentNodeTemplate 정의 된 재정의 및 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>

설명

설정를 CurrentNodeTemplateITemplate 개체를 사용 하 여는 Image 컨트롤 또는 다른 컨트롤을 같은 Label, 문자열 대신 하는 현재 노드의 사용자 인터페이스 요소로 합니다.

경우는 CurrentNodeTemplate 속성을 설정 하면 표시 되는 현재 탐색 노드 텍스트와 모든 템플릿을 재정의 CurrentNodeStyle 적용 합니다. 그러나 현재 표시 된 루트 노드에 해당 하는 경우는 RootNodeTemplate 또는 RootNodeStyle 사용 됩니다.

선언적으로 설정할 수 있습니다 합니다 CurrentNodeTemplate 로 웹 서버 컨트롤을 래핑하는 데 필요한 단계를 수행 하는 속성을 모든 웹 서버 컨트롤과 ASP.NET 인프라는 ITemplate 개체입니다. 그러나 웹 서버 컨트롤 구현 하지 않습니다는 ITemplate 인터페이스 이므로 작업을 수행할 때 합니다 ITemplate 속성을 프로그래밍 방식으로 작성 해야 합니다는 ITemplate 모든 템플릿 코드에 대 한 래퍼입니다. 그런 다음, CurrentNodeTemplate 인스턴스의 속성을 ITemplate 래퍼입니다.

적용 대상

추가 정보