첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
유용한 소스 코드가 있으면 icodebroker@naver.com으로 보내주시면 감사합니다.
블로그 자료는 자유롭게 사용하세요.

■ UserControl 클래스 : 웹 사이트 뼈대 만들기

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


TestProject.zip


NavigatorUserControl.ascx

 

 

<%@ Control Language="C#" AutoEventWireup="true"

    CodeBehind="NavigatorUserControl.ascx.cs"

    Inherits="TestProject.NavigatorUserControl" %>

<div class="text-center">

내비게이터

</div>

 

 

CategoryUserControl.ascx

 

 

<%@ Control Language="C#" AutoEventWireup="true"

    CodeBehind="CategoryUserControl.ascx.cs"

    Inherits="TestProject.CategoryUserControl" %>

<div class="text-center">

카테고리

</div>

 

 

CatalogUserControl.ascx

 

 

<%@ Control Language="C#" AutoEventWireup="true"

    CodeBehind="CatalogUserControl.ascx.cs"

    Inherits="TestProject.CatalogUserControl" %>

<div class="text-center">

카탈로그

</div>

 

 

CopyrightUserControl.ascx

 

 

<%@ Control Language="C#" AutoEventWireup="true"

    CodeBehind="CopyrightUserControl.ascx.cs"

    Inherits="TestProject.CopyrightUserControl" %>

<div class="text-center">

저작권

</div>

 

 

MainPage.aspx

 

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="TestProject.MainPage" %>

<%@ Register TagPrefix="local" TagName="NavigatorUserControl" Src="~/NavigatorUserControl.ascx" %>

<%@ Register TagPrefix="local" TagName="CategoryUserControl"  Src="~/CategoryUserControl.ascx"  %>

<%@ Register TagPrefix="local" TagName="CatalogUserControl"   Src="~/CatalogUserControl.ascx"   %>

<%@ Register TagPrefix="local" TagName="CopyrightUserControl" Src="~/CopyrightUserControl.ascx" %>

<!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>UserControl 클래스 : 웹 사이트 뼈대 만들기</title>

        <link href="Content/bootstrap.css" rel="stylesheet" />

        <style>

            div

            {

                border  : 1px solid red;

                padding : 10px;

            }

        </style>

    </head>

    <body>

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

            <div class="container">

                <div class="row">

                    <div class="col-md-12">

                        <local:NavigatorUserControl ID="navigatorUserControl" runat="server" />

                    </div>

                </div>

                <div class="row" style="height: 200px;">

                    <div class="col-md-3">

                        <local:CategoryUserControl ID="categoryUserControl" runat="server" />

                    </div>

                    <div class="col-md-9">

                        <local:CatalogUserControl ID="catalogUserControl" runat="server" />

                    </div>

                </div>

                <div class="row">

                    <div class="col-md-12">

                        <local:CopyrightUserControl ID="copyrightUserControl" runat="server" />

                    </div>

                </div>

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

댓글을 달아 주세요