Login.LayoutTemplate 속성

정의

Login 컨트롤을 표시하는 데 사용되는 템플릿을 가져오거나 설정합니다.

public:
 virtual property System::Web::UI::ITemplate ^ LayoutTemplate { 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.Login))]
public virtual System.Web.UI.ITemplate LayoutTemplate { get; set; }
[<System.ComponentModel.Browsable(false)>]
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
[<System.Web.UI.TemplateContainer(typeof(System.Web.UI.WebControls.Login))>]
member this.LayoutTemplate : System.Web.UI.ITemplate with get, set
Public Overridable Property LayoutTemplate As ITemplate

속성 값

ITemplate

ITemplate 컨트롤을 표시하기 위한 템플릿이 들어 있는 Login입니다. 기본값은 null입니다.

특성

예제

다음 코드 예제에서는 컨트롤에 대 한 템플릿을 Login 만듭니다.

중요

이 예제에서는 잠재적 보안 위협을 사용자 입력을 허용 하는 텍스트 상자가 포함 되어 있습니다. 기본적으로 ASP.NET 웹 페이지는 사용자 입력 내용에 스크립트 또는 HTML 요소가 포함되어 있지 않은지 확인합니다. 자세한 내용은 Script Exploits Overview를 참조하세요.

<%@ Page Language="C#" AutoEventWireup="False"%>
<!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">
            <asp:Login id="Login1" runat="server">
                <LayoutTemplate>
                    <table>
                        <tr>
                            <td colspan="2" align="center">
                                Login
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                Enter your user name and password to log in.
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td>
                                            User name:
                                        </td>
                                        <td>
                                            <asp:TextBox id="UserName" runat="server"></asp:TextBox>
                                            <asp:requiredfieldvalidator id="UserNameRequired" runat="server" ControlToValidate="UserName" Text="*"></asp:requiredfieldvalidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Password:</td>
                                        <td>
                                            <asp:TextBox id="Password" runat="server" textMode="Password"></asp:TextBox>
                                            <asp:requiredfieldvalidator id="PasswordRequired" runat="server" ControlToValidate="Password" Text="*"></asp:requiredfieldvalidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:Checkbox id="RememberMe" runat="server" Text="Remember my login"></asp:Checkbox>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td valign="middle">
                                <ul>
                                    <li><a href="newAccount.aspx">Create a new account...</a></li>
                                    <li><a href="getPass.aspx">Forgot your password?</a></li>
                                    <li><a href="help.aspx">Get help logging in...</a></li>
                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:button id="Login" CommandName="Login" runat="server" Text="Login"></asp:button>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:Literal id="FailureText" runat="server"></asp:Literal></td>
                        </tr>
                    </table>
                </LayoutTemplate>
            </asp:Login>
        </form>
    </body>
</html>
<%@ Page Language="VB" AutoEventWireup="False"%>
<!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">
            <asp:Login id="Login1" runat="server">
                <LayoutTemplate>
                    <table>
                        <tr>
                            <td colspan="2" align="center">
                                Login
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                Enter your user name and password to log in.
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <table>
                                    <tr>
                                        <td>
                                            User name:
                                        </td>
                                        <td>
                                            <asp:TextBox id="UserName" runat="server"></asp:TextBox>
                                            <asp:requiredfieldvalidator id="UserNameRequired" runat="server" ControlToValidate="UserName" Text="*"></asp:requiredfieldvalidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>Password:</td>
                                        <td>
                                            <asp:TextBox id="Password" runat="server" textMode="Password"></asp:TextBox>
                                            <asp:requiredfieldvalidator id="PasswordRequired" runat="server" ControlToValidate="Password" Text="*"></asp:requiredfieldvalidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <asp:Checkbox id="RememberMe" runat="server" Text="Remember my login"></asp:Checkbox>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                            <td valign="middle">
                                <ul>
                                    <li><a href="newAccount.aspx">Create a new account...</a></li>
                                    <li><a href="getPass.aspx">Forgot your password?</a></li>
                                    <li><a href="help.aspx">Get help logging in...</a></li>
                                </ul>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:button id="Login" CommandName="Login" runat="server" Text="Login"></asp:button>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" align="center">
                                <asp:Literal id="FailureText" runat="server"></asp:Literal></td>
                        </tr>
                    </table>
                </LayoutTemplate>
            </asp:Login>
        </form>
    </body>
</html>

설명

이 속성에는 LayoutTemplate 컨트롤이 사용자에게 표시되는 방법을 Login 정의하는 템플릿이 포함되어 있습니다.

다음 표에서는 컨트롤 템플릿에 사용되는 필수 및 선택적 컨트롤을 Login 나열합니다.

ID 또는 명령 이름 컨트롤 형식 필수/선택
UserName 사용자 지정 또는 타사 컨트롤을 IEditableTextControl포함하여 TextBox구현하는 모든 컨트롤입니다. 필수
Password 사용자 지정 또는 타사 컨트롤을 IEditableTextControl포함하여 TextBox구현하는 모든 컨트롤입니다. 필수
RememberMe CheckBox 옵션
FailureText 구현 하는 모든 컨트롤 ITextControl합니다. 선택 사항
Login 버블링 이벤트를 발생 시키는 모든 컨트롤입니다. 선택 사항

Login 레이아웃 템플릿에 HttpException 필요한 컨트롤이 포함되어 있지 않으면 컨트롤이 예외를 throw합니다. 예외가 throw 되지 않습니다; 잘못 된 형식의 컨트롤에 선택적 컨트롤 ID를 제공 하는 경우 그러나 컨트롤은 이후에 무시는 Login 제어 합니다.

로그인 컨트롤은 이벤트 버블링(예: Button, LinkButton또는 ImageButton)을 발생시키는 모든 컨트롤일 수 있습니다. 컨트롤의 명령 이름 속성을 "로그인"으로 설정해야 합니다.

템플릿이 컨트롤에 Login 사용되는 경우 다음 속성만 컨트롤의 동작에 영향을 미칩니다.

컨트롤에 대해 Login 템플릿이 설정되면 다른 모든 속성이 비활성 상태입니다.

적용 대상

추가 정보