다음을 통해 공유


TextBox.AutoCompleteType 속성

정의

TextBox 컨트롤의 자동 완성 동작을 나타내는 값을 가져오거나 설정합니다.

public:
 virtual property System::Web::UI::WebControls::AutoCompleteType AutoCompleteType { System::Web::UI::WebControls::AutoCompleteType get(); void set(System::Web::UI::WebControls::AutoCompleteType value); };
[System.Web.UI.Themeable(false)]
public virtual System.Web.UI.WebControls.AutoCompleteType AutoCompleteType { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.AutoCompleteType : System.Web.UI.WebControls.AutoCompleteType with get, set
Public Overridable Property AutoCompleteType As AutoCompleteType

속성 값

AutoCompleteType

AutoCompleteType 컨트롤의 자동 완성 동작을 나타내는 TextBox 열거형 값 중 하나입니다. 기본값은 None입니다.

특성

예외

선택한 값이 AutoCompleteType 열거형 값 중 하나가 아닌 경우

예제

다음 코드 예제에서는 열거형을 사용 하 여 AutoCompleteType 컨트롤에 대 한 자동 완성 범주를 지정 하는 TextBox 방법을 보여 줍니다.

중요

이 예제에는 사용자 입력을 허용하는 텍스트 상자가 있으므로 보안상 위험할 수 있습니다. 기본적으로 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">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>AutoCompleteType example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <!-- You need to enable the AutoComplete feature on -->
      <!-- a browser that supports it (such as Internet   -->
      <!-- Explorer 5.0 and later) for this sample to     -->
      <!-- work. The AutoComplete lists are created after -->
      <!-- the Submit button is clicked.                  -->
    
      <h3>AutoCompleteType example</h3>
    
      Enter values in the text boxes and click the Submit <br/>
      button. <br/><br/> 
    
      <!-- The following TextBox controls have different  -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties.                                    -->
      First Name:<br/>
      <asp:textbox id="FirstNameTextBox"
        autocompletetype="FirstName" 
        runat="server"/>
      <br/>
        
      Last Name:<br/>   
      <asp:textbox id="LastNameTextBox"
        autocompletetype="LastName" 
        runat="server"/>
      <br/>
      
      Email:<br/>   
      <asp:textbox id="EmailTextBox"
        autocompletetype="Email" 
        runat="server"/>
      <br/>
      
      <!-- The following TextBox controls have the same   -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties. They share the same AutoComplete   -->
      <!-- list.                                          -->
      Phone Line #1:<br/>
      <asp:textbox id="Phone1TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>
      
      Phone Line #2:<br/>
      <asp:textbox id="Phone2TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>

    
      <!-- The following TextBox control has its          -->
      <!-- AutoCompleteType property set to               -->
      <!-- AutoCompleteType.None. All TextBox controls    -->
      <!-- with the same ID across different pages share  -->
      <!-- the same AutoComplete list.                    -->
      Category:<br/>   
      <asp:textbox id="CategoryTextBox"
        autocompletetype="None" 
        runat="server"/>
      <br/>
        
      <!-- The following TextBox control has the          -->
      <!-- AutoComplete feature disabled.                 -->
      Comments:<br/>   
      <asp:textbox id="CommentsTextBox"
        autocompletetype="Disabled" 
        runat="server"/>
      <br/>
      <br/><br/>  
      
      <asp:button id="SubmitButton"
        text="Submit"
        runat="Server"/>
    
    </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">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>AutoCompleteType example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <!-- You need to enable the AutoComplete feature on -->
      <!-- a browser that supports it (such as Internet   -->
      <!-- Explorer 5.0 and later) for this sample to     -->
      <!-- work. The AutoComplete lists are created after -->
      <!-- the Submit button is clicked.                  -->
    
      <h3>AutoCompleteType example</h3>
    
      Enter values in the text boxes and click the Submit <br/>
      button. <br/><br/> 
    
      <!-- The following TextBox controls have different  -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties.                                    -->
      First Name:<br/>
      <asp:textbox id="FirstNameTextBox"
        autocompletetype="FirstName" 
        runat="server"/>
      <br/>
        
      Last Name:<br/>   
      <asp:textbox id="LastNameTextBox"
        autocompletetype="LastName" 
        runat="server"/>
      <br/>
      
      Email:<br/>   
      <asp:textbox id="EmailTextBox"
        autocompletetype="Email" 
        runat="server"/>
      <br/>
      
      <!-- The following TextBox controls have the same   -->
      <!-- categories assigned to their AutoCompleteType  -->
      <!-- properties. They share the same AutoComplete   -->
      <!-- list.                                          -->
      Phone Line #1:<br/>
      <asp:textbox id="Phone1TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>
      
      Phone Line #2:<br/>
      <asp:textbox id="Phone2TextBox"
        autocompletetype="HomePhone" 
        runat="server"/>
      <br/>

    
      <!-- The following TextBox control has its          -->
      <!-- AutoCompleteType property set to               -->
      <!-- AutoCompleteType.None. All TextBox controls    -->
      <!-- with the same ID across different pages share  -->
      <!-- the same AutoComplete list.                    -->
      Category:<br/>   
      <asp:textbox id="CategoryTextBox"
        autocompletetype="None" 
        runat="server"/>
      <br/>
        
      <!-- The following TextBox control has the          -->
      <!-- AutoComplete feature disabled.                 -->
      Comments:<br/>   
      <asp:textbox id="CommentsTextBox"
        autocompletetype="Disabled" 
        runat="server"/>
      <br/>
      <br/><br/>  
      
      <asp:button id="SubmitButton"
        text="Submit"
        runat="Server"/>
    
    </form>
  </body>
</html>

설명

데이터 입력을 지원하기 위해 Microsoft Internet Explorer 5 이상 및 일부 다른 브라우저는 자동 완성이라는 기능을 지원합니다. 자동 완성은 텍스트 상자를 모니터링하고 사용자가 입력한 값 목록을 만듭니다. 나중에 사용자가 텍스트 상자로 돌아오면 목록이 표시됩니다. 사용자가 이전에 입력한 값을 다시 지정하는 대신 이 목록에서 값을 선택할 수 있습니다. 속성을 AutoCompleteType 사용하여 컨트롤에 대한 자동 완성 기능의 동작을 TextBox 제어합니다. System.Web.UI.WebControls.AutoCompleteType 열거형에 적용할 수 있는 값을 나타내는 데는 AutoCompleteType 속성입니다.

참고

일부 브라우저는 자동 완성 기능을 지원합니다. 호환성을 확인 하려면 브라우저를 사용 하 여 확인 합니다.

기본적으로 AutoCompleteType 에 대 한 속성을 TextBox 로 설정 되어 AutoCompleteType.None입니다. 이 설정을 사용하면 컨트롤이 TextBox 다른 페이지에서 동일한 ID 속성을 가진 다른 TextBox 컨트롤과 목록을 공유합니다. 속성 대신 ID 범주에 따라 컨트롤 간에 TextBox 목록을 공유할 수도 있습니다. 속성을 범주 값(예: AutoCompleteType.FirstNameAutoCompleteType.LastName) 중 하나로 설정 AutoCompleteType 하면 범주가 동일한 모든 TextBox 컨트롤이 동일한 목록을 공유합니다. 에 대 한 자동 완성 기능을 비활성화할 수 있습니다는 TextBox 설정 하 여 컨트롤을 AutoCompleteType 속성을 AutoCompleteType.Disabled입니다.

구성 및 자동 완성 기능 사용에 대 한 세부 정보에 대 한 브라우저 설명서를 참조 하세요. 예를 들어 Internet Explorer 버전 5 이상에서 자동 완성 기능을 사용하도록 설정하려면 도구 메뉴에서 인터넷 옵션을 선택한 다음 콘텐츠 탭을 선택합니다. 자동 완성 단추를 클릭하여 자동 완성 기능에 대한 다양한 브라우저 옵션을 보고 수정합니다.

Internet Explorer의 자동 완성 기능에 대한 자세한 내용은 HTML Forms에서 자동 완성 사용을 참조하세요.

이 속성은 테마 또는 스타일시트 테마에 의해 설정될 수 없습니다. 자세한 내용은 ThemeableAttribute 하 고 ASP.NET 테마 및 스킨합니다.

적용 대상

추가 정보