AutoCompleteType 列挙型

定義

TextBox コントロールの AutoComplete 機能の動作を制御する値を表します。

public enum class AutoCompleteType
public enum AutoCompleteType
type AutoCompleteType = 
Public Enum AutoCompleteType
継承
AutoCompleteType

フィールド

BusinessCity 23

勤務先の住所の都市のカテゴリ。

BusinessCountryRegion 24

勤務先の住所の国/地域のカテゴリ。

BusinessFax 25

勤務先の住所のファックス番号のカテゴリ。

BusinessPhone 26

勤務先の住所の電話番号のカテゴリ。

BusinessState 27

勤務先の住所の都道府県のカテゴリ。

BusinessStreetAddress 28

勤務先の住所の番地のカテゴリ。

BusinessUrl 29

会社の Web サイトの URL のカテゴリ。

BusinessZipCode 30

勤務先の住所の郵便番号のカテゴリ。

Cellular 2

携帯電話の電話番号のカテゴリ。

Company 3

社名のカテゴリ。

Department 4

社内の部署のカテゴリ。

Disabled 1

TextBox コントロールの AutoComplete 機能は無効です。

DisplayName 5

表示するユーザー名のカテゴリ。

Email 6

ユーザーの電子メール アドレスのカテゴリ。

Enabled 32

TextBox コントロールの AutoComplete 機能は有効です。

FirstName 7

最初の名前カテゴリ。

Gender 8

ユーザーの性別のカテゴリ。

HomeCity 9

自宅の住所の都市のカテゴリ。

HomeCountryRegion 10

自宅の住所の国/地域のカテゴリ。

HomeFax 11

自宅の住所のファックス番号のカテゴリ。

Homepage 16

Web サイトの URL のカテゴリ。

HomePhone 12

自宅の住所の電話番号のカテゴリ。

HomeState 13

自宅の住所の都道府県のカテゴリ。

HomeStreetAddress 14

自宅の住所の番地のカテゴリ。

HomeZipCode 15

自宅の住所の郵便番号のカテゴリ。

JobTitle 17

ユーザーの職種のカテゴリ。

LastName 18

最後の名前カテゴリ。

MiddleName 19

ユーザーのミドル ネームのカテゴリ。

None 0

TextBox コントロールに関連付けられているカテゴリはありません。 TextBox が同じである ID コントロールはすべて、同じ値リストを共有します。

Notes 20

カテゴリのフォームに含める補足情報。

Office 21

事業所の所在地のカテゴリ。

Pager 22

ポケットベルの電話番号のカテゴリ。

31

Web ページまたは Web サイトのカテゴリを検索するために使用するキーワード。

次の例では、 列挙を使用してコントロールの AutoCompleteType AutoComplete カテゴリを指定する方法を TextBox 示します。

重要

この例には、ユーザー入力を受け付けるテキスト ボックスがあります。これにより、セキュリティが脆弱になる可能性があります。 既定では、ASP.NET Web ページによって、ユーザー入力にスクリプトまたは HTML 要素が含まれていないかどうかが検証されます。 詳細については、「スクリプトによる攻略の概要」を参照してください。


<%@ 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>

注釈

データ入力を支援するために、Internet Explorer 5 以降およびその他のブラウザーでは AutoComplete という名前の機能がサポートされています。 オートコンプリートは、テキスト ボックスを監視し、ユーザーが入力した値の一覧を格納します。 ユーザーが別の時点でテキスト ボックスに戻ると、値の一覧が表示されます。 ユーザーは値を再入力する代わりに、この一覧から値を選択できます。

注意

すべてのブラウザーでオートコンプリート機能がサポートされているわけではありません。 ブラウザーで互換性を確認してください。

コントロールのオートコンプリート機能の動作を TextBox 制御するには、 プロパティを AutoCompleteType 使用します。 AutoCompleteType列挙は、 プロパティに適用できる値を表すためにAutoCompleteType使用されます。

既定では、コントロールの AutoCompleteTypeTextBox プロパティは に AutoCompleteType.None設定されます。 この設定では、コントロールはTextBox異なるページ間で同じIDリストを他TextBoxのコントロールと共有します。 また、 に基づくのではなく、カテゴリに基づくコントロール間 TextBox でリストを ID共有することもできます。 プロパティをAutoCompleteTypeいずれかのカテゴリ値 (や AutoCompleteType.LastNameなどAutoCompleteType.FirstName) に設定すると、同じカテゴリを持つすべてのTextBoxコントロールが同じリストを共有します。 コントロールのオートコンプリート機能を無効にするには、 プロパティを TextBoxAutoCompleteTypeAutoCompleteType.Disabled設定します。

オートコンプリート機能の構成と有効化の詳細については、ブラウザーのドキュメントを参照してください。 たとえば、Internet Explorer バージョン 5 以降でオートコンプリート機能を有効にするには、[ ツール ] メニューから [ インターネット オプション] を選択します。 次に、[ コンテンツ ] タブを選択します。[ オートコンプリート ] ボタンを選択して、オートコンプリート機能のオプションを表示および変更します。

適用対象

こちらもご覧ください