■ TreeView 클래스 사용하기

------------------------------------------------------------------------------------------------------------------------

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>TreeView 클래스 사용하기</title>

    </head>

    <body>

        <form id="form" runat="server">

            <div>

                <asp:TreeView ID="treeView" runat="server">

                    <Nodes>

                        <asp:TreeNode Text="대분류 1" Value="메뉴1">

                            <asp:TreeNode Text="중분류 1" Value="메뉴2" />

                            <asp:TreeNode Text="중분류 2" Value="메뉴3" />

                        </asp:TreeNode>

                        <asp:TreeNode Text="대분류 2" Value="메뉴4" />

                        <asp:TreeNode Text="대분류 3" Value="메뉴5" />

                    </Nodes>

                </asp:TreeView>

            </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

    }

}

 

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요