Login.LoginButtonType 속성

정의

Login 단추를 렌더링할 때 사용할 단추의 종류를 가져오거나 설정합니다.

public:
 virtual property System::Web::UI::WebControls::ButtonType LoginButtonType { System::Web::UI::WebControls::ButtonType get(); void set(System::Web::UI::WebControls::ButtonType value); };
public virtual System.Web.UI.WebControls.ButtonType LoginButtonType { get; set; }
member this.LoginButtonType : System.Web.UI.WebControls.ButtonType with get, set
Public Overridable Property LoginButtonType As ButtonType

속성 값

ButtonType

ButtonType 열거형 값 중 하나입니다. 기본값은 Button입니다.

예외

LoginButtonType 속성이 올바른 ButtonType 열거형 값으로 설정되지 않은 경우

예제

다음 코드 예제에서는 컨트롤에 사용할 수 있는 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">

    void changeButton_Click(Object sender, EventArgs e) 
    {
      if (ChooseButtonType.SelectedValue == "Button")
      {
        Login1.LoginButtonType = ButtonType.Button;
      }
      if (ChooseButtonType.SelectedValue == "Image")
      {
        Login1.LoginButtonType = ButtonType.Image;
      }
      if (ChooseButtonType.SelectedValue == "Link")
      {
        Login1.LoginButtonType = ButtonType.Link;
      }
      
      Login1.LoginButtonText = Server.HtmlEncode(buttonText.Text);
    }

</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
     <form id="form1" runat="server">
       <table>
           <tr>
             <td>Login Button Text:
             </td>
             <td>
               <asp:TextBox id="buttonText" 
                            runat="server"
                            Text="Login"></asp:TextBox>
             </td>
             <td>Button Type:
             </td>
             <td>
               <asp:DropDownList id="ChooseButtonType" 
                                 runat="server">
                 <asp:ListItem value="Button"
                               selected="true"></asp:ListItem>
                 <asp:ListItem value="Image"></asp:ListItem>
                 <asp:ListItem value="Link"></asp:ListItem>
               </asp:DropDownList>
             </td>
             <td>
                        <asp:Button id="changeButton" runat="server" Text="Change" OnClick="changeButton_Click"></asp:Button>
             </td>
           </tr>
           <tr>
             <td colspan="4" 
                 align="center">
             <asp:Login id="Login1" 
                        runat="server" 
                        LoginButtonType="Image" 
                        LoginButtonText="Log in to Web Site."
                        LoginButtonImageUrl="images\login.png">
             </asp:Login>
             </td>
           </tr>
        </table>
     </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">
    
  Sub changeButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    If (ChooseButtonType.SelectedValue = "Button") Then
      
      Login1.LoginButtonType = System.Web.UI.WebControls.ButtonType.Button
      
    End If
    
    If (ChooseButtonType.SelectedValue = "Image") Then
      
      Login1.LoginButtonType = System.Web.UI.WebControls.ButtonType.Image
      
    End If
    If (ChooseButtonType.SelectedValue = "Link") Then
      
      Login1.LoginButtonType = System.Web.UI.WebControls.ButtonType.Link
      
    End If
    
    Login1.LoginButtonText = Server.HtmlEncode(buttonText.Text)
    
  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">
       <table>
           <tr>
             <td>Login Button Text:
             </td>
             <td>
               <asp:TextBox id="buttonText" 
                            runat="server"
                            Text="Login"></asp:TextBox>
             </td>
             <td>Button Type:
             </td>
             <td>
               <asp:DropDownList id="ChooseButtonType" 
                                 runat="server">
                 <asp:ListItem value="Button"
                               selected="true"></asp:ListItem>
                 <asp:ListItem value="Image"></asp:ListItem>
                 <asp:ListItem value="Link"></asp:ListItem>
               </asp:DropDownList>
             </td>
             <td>
                        <asp:Button id="changeButton" runat="server" Text="Change" OnClick="changeButton_Click"></asp:Button>
             </td>
           </tr>
           <tr>
             <td colspan="4" 
                 align="center">
             <asp:Login id="Login1" 
                        runat="server" 
                        LoginButtonType="Image" 
                        LoginButtonText="Log in to Web Site."
                        LoginButtonImageUrl="images\login.png">
             </asp:Login>
             </td>
           </tr>
        </table>
     </form>
  </body>
</html>

설명

이 속성은 LoginButtonType 컨트롤의 로그인 단추에 Login 사용할 단추의 유형을 결정합니다. 다음 표에서는 다양한 단추 형식에 대해 설명합니다.

LoginButtonType 설정 렌더링된 단추의 유형
Button 속성에 지정된 텍스트가 있는 HTML 단추입니다 LoginButtonText .
Image 이미지 이미지의 URL은 속성에 LoginButtonImageUrl 지정됩니다. 속성에 지정된 문자열은 이미지의 LoginButtonText 대체 텍스트로 사용됩니다.
Link 속성에 지정된 텍스트가 있는 HTML 링크입니다 LoginButtonText .

속성이 LoginButtonType 설정되거나 Link설정 Button 되면 속성의 LoginButtonImageUrl 내용이 무시됩니다.

적용 대상

추가 정보