Login.TextBoxStyle 속성

정의

Login 컨트롤의 텍스트 상자 모양을 정의하는 속성이 들어 있는 컬렉션에 대한 참조를 가져옵니다.

public:
 property System::Web::UI::WebControls::Style ^ TextBoxStyle { System::Web::UI::WebControls::Style ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.Style TextBoxStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.TextBoxStyle : System.Web.UI.WebControls.Style
Public ReadOnly Property TextBoxStyle As Style

속성 값

텍스트 상자의 모양을 정의하는 속성이 들어 있는 Style에 대한 참조입니다.

특성

예제

다음 코드 예제에서는 설정 하 여 사용자 이름 및 암호 TextBox 컨트롤의 배경색 및 텍스트 색을 참조 TextBoxStyle 하는 개체에 Style 속성을 설정 하 여는 속성입니다.

중요

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

<%@ 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">
void OnLoginError(object server, EventArgs e) 
{
    Login1.TextBoxStyle.BackColor = System.Drawing.Color.Red;
}
</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"
                OnLoginError="OnLoginError">
                <TextBoxStyle 
                    BorderStyle="Inset" 
                    ForeColor="#FFFFC0" 
                    BackColor="Gray">
                </TextBoxStyle>
            </asp:Login>

        </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">
Sub OnLoginError(ByVal sender As Object, ByVal e As EventArgs)
    Login1.TextBoxStyle.BackColor = System.Drawing.Color.Red
End Sub
</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"
                OnLoginError="OnLoginError">
                <TextBoxStyle 
                    BorderStyle="Inset" 
                    ForeColor="#FFFFC0" 
                    BackColor="Gray">
                </TextBoxStyle>
            </asp:Login>

        </form>
    </body>
</html>

설명

속성은 TextBoxStyle 컨트롤에서 사용자 이름 및 암호 TextBox 컨트롤의 모양을 정의합니다 Login . 이 속성은 읽기 전용입니다. 그러나의 속성을 설정할 수는 Style 개체를 반환 합니다. 형식에서 선언적으로 이러한 속성을 설정할 수 있습니다 Property-Subproperty, 여기서 Subproperty 의 속성을 나타냅니다 합니다 Style 클래스 (예를 들어 TextBoxStyle-ForeColor). 형식에서 속성을 프로그래밍 방식으로 설정할 수 있습니다 Property.Subproperty (예를 들어 TextBoxStyle.ForeColor).

일반 설정 사용자 지정 배경색, 텍스트 색 및 글꼴 속성을 포함 합니다. 속성은 TextBoxStyle 사용자 이름 및 암호 텍스트 상자의 모양을 정의합니다.

에 대 한 스타일 설정을 합니다 TextBoxStyle 속성에 대 한 스타일 설정을 사용 하 여 병합 되는 Login 컨트롤. 모든 설정이 합니다 TextBoxStyle 속성의 속성에서 해당 설정을 재정의 Login 제어 합니다.

다음 Login 스타일 속성은 TextBoxStyle 설정:

모양을 정의 하는 데 템플릿을 사용할 때의 Login 컨트롤을 TextBoxStyle 속성이 적용 되지 않습니다.

적용 대상

추가 정보