■ SiteMapPath 클래스 사용하기
------------------------------------------------------------------------------------------------------------------------
▶ Web.sitemap
<?xml version="1.0" encoding="utf-8" ?> <siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" > <siteMapNode url="~/MainPage.aspx" title="Home" description="홈"> <siteMapNode url="~/SubPage1.aspx" title="대분류 1" description="서브 페이지 1"> <siteMapNode url="~/SubPage2.aspx" title="중분류 1-1" description="서브 페이지 2"/> <siteMapNode url="~/SubPage3.aspx" title="중분류 1-2" description="서브 페이지 3"/> </siteMapNode> <siteMapNode url="~/SubPage4.aspx" title="대분류 2" description="서브 페이지 4" /> <siteMapNode url="~/SubPage5.aspx" title="대분류 3" description="서브 페이지 5" /> </siteMapNode> </siteMap>
|
▶ MainPage.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="TestProject.MainPage" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SiteMapPath 클래스 사용하기</title> </head> <body> <form id="form" runat="server"> <div> <asp:SiteMapPath ID="siteMapPath" runat="server" /> <hr /> <h1>메인 페이지</h1> <a href="SubPage1.aspx">대분류 1</a> <a href="SubPage4.aspx">대분류 2</a> <a href="SubPage5.aspx">대분류 3</a> </div> </form> </body> </html>
|
▶ MainPage.aspx.cs
using System; using System.Web.UI;
namespace TestProject { /// <summary> /// 메인 페이지 /// </summary> public partial class MainPage : Page { //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 페이지 로드시 처리하기 - Page_Load(sender, e)
/// <summary> /// 페이지 로드시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> protected void Page_Load(object sender, EventArgs e) { }
#endregion } }
|
▶ SubPage1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubPage1.aspx.cs" Inherits="TestProject.SubPage1" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SiteMapPath 클래스 사용하기</title> </head> <body> <form id="form" runat="server"> <div> <asp:SiteMapPath ID="siteMapPath" runat="server" /> <hr /> <h1>대분류 1</h1> <a href="SubPage2.aspx">중분류 1-1</a> <br /> <a href="SubPage3.aspx">중분류 1-2</a> </div> </form> </body> </html>
|
▶ SubPage1.aspx.cs
using System; using System.Web.UI;
namespace TestProject { /// <summary> /// 서브 페이지 1 /// </summary> public partial class SubPage1 : Page { //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 페이지 로드시 처리하기 - Page_Load(sender, e)
/// <summary> /// 페이지 로드시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> protected void Page_Load(object sender, EventArgs e) { }
#endregion } }
|
▶ SubPage2.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubPage2.aspx.cs" Inherits="TestProject.SubPage2" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SiteMapPath 클래스 사용하기</title> </head> <body> <form id="form" runat="server"> <div> <asp:SiteMapPath ID="siteMapPath" runat="server" /> <hr /> <h1>중분류 1-1</h1> </div> </form> </body> </html>
|
▶ SubPage2.aspx.cs
using System; using System.Web.UI;
namespace TestProject { /// <summary> /// 서브 페이지 2 /// </summary> public partial class SubPage2 : Page { //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 페이지 로드시 처리하기 - Page_Load(sender, e)
/// <summary> /// 페이지 로드시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> protected void Page_Load(object sender, EventArgs e) { }
#endregion } }
|
▶ SubPage3.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubPage3.aspx.cs" Inherits="TestProject.SubPage3" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SiteMapPath 클래스 사용하기</title> </head> <body> <form id="form" runat="server"> <div> <asp:SiteMapPath ID="siteMapPath" runat="server" /> <hr /> <h1>중분류 1-2</h1> </div> </form> </body> </html>
|
▶ SubPage3.aspx.cs
using System; using System.Web.UI;
namespace TestProject { /// <summary> /// 서브 페이지 3 /// </summary> public partial class SubPage3 : Page { //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 페이지 로드시 처리하기 - Page_Load(sender, e)
/// <summary> /// 페이지 로드시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> protected void Page_Load(object sender, EventArgs e) { }
#endregion } }
|
▶ SubPage4.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubPage4.aspx.cs" Inherits="TestProject.SubPage4" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SiteMapPath 클래스 사용하기</title> </head> <body> <form id="form" runat="server"> <div> <asp:SiteMapPath ID="siteMapPath" runat="server" /> <hr /> <h1>대분류 2</h1> </div> </form> </body> </html>
|
▶ SubPage4.aspx.cs
using System; using System.Web.UI;
namespace TestProject { /// <summary> /// 서브 페이지 4 /// </summary> public partial class SubPage4 : Page { //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 페이지 로드시 처리하기 - Page_Load(sender, e)
/// <summary> /// 페이지 로드시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> protected void Page_Load(object sender, EventArgs e) { }
#endregion } }
|
▶ SubPage5.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SubPage5.aspx.cs" Inherits="TestProject.SubPage5" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SiteMapPath 클래스 사용하기</title> </head> <body> <form id="form" runat="server"> <div> <asp:SiteMapPath ID="siteMapPath" runat="server" /> <hr /> <h1>대분류 3</h1> </div> </form> </body> </html>
|
▶ SubPage5.aspx.cs
using System; using System.Web.UI;
namespace TestProject { /// <summary> /// 서브 페이지 5 /// </summary> public partial class SubPage5 : Page { //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Protected
#region 페이지 로드시 처리하기 - Page_Load(sender, e)
/// <summary> /// 페이지 로드시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> protected void Page_Load(object sender, EventArgs e) { }
#endregion } }
|
------------------------------------------------------------------------------------------------------------------------
'C# > ASP.NET' 카테고리의 다른 글
[C#/ASP.NET] Page 클래스 : Application 속성을 사용해 현재 접속자 수 표시하기 (0) | 2019.12.15 |
---|---|
[C#/ASP.NET] ASP.NET이 제공하는 상태 관리 기법 (0) | 2019.12.15 |
[C#/ASP.NET] TreeView 클래스 : DataSourceID 속성을 사용해 사이트맵 트리 구조 만들기 (0) | 2019.12.14 |
[C#/ASP.NET] TreeView 클래스 사용하기 (0) | 2019.12.14 |
[C#/ASP.NET] Menu 클래스 : 메뉴 사용하기 (0) | 2019.12.14 |
[C#/ASP.NET] SiteMapPath 클래스 사용하기 (0) | 2019.12.14 |
[C#/ASP.NET] Control 클래스 : EnableTheming 속성을 사용해 테마 적용 여부 설정하기 (0) | 2019.12.14 |
[C#/ASP.NET] Web.config 파일을 설정해 테마 설정하기 (0) | 2019.12.14 |
[C#/ASP.NET] Control 클래스 : SkinID 속성을 사용해 테마 설정하기 (0) | 2019.12.14 |
[C#/ASP.NET] Page 클래스 : Theme 속성을 사용해 테마 설정하기 (0) | 2019.12.14 |
[C#/ASP.NET] MasterPage 클래스 : 마스터 페이지 사용하기 (0) | 2019.12.14 |
댓글을 달아 주세요