HtmlInputPassword クラスとは? わかりやすく解説

HtmlInputPassword クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

サーバーHTML <input type= password> 要素へのプログラムによるアクセス許可します

名前空間: System.Web.UI.HtmlControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

<ValidationPropertyAttribute("Value")> _
Public Class HtmlInputPassword
    Inherits HtmlInputText
    Implements IPostBackDataHandler
Dim instance As HtmlInputPassword
[ValidationPropertyAttribute("Value")] 
public class HtmlInputPassword : HtmlInputText,
 IPostBackDataHandler
[ValidationPropertyAttribute(L"Value")] 
public ref class HtmlInputPassword : public
 HtmlInputText, IPostBackDataHandler
/** @attribute ValidationPropertyAttribute("Value") */ 
public class HtmlInputPassword extends HtmlInputText
 implements IPostBackDataHandler
ValidationPropertyAttribute("Value") 
public class HtmlInputPassword extends
 HtmlInputText implements IPostBackDataHandler
解説解説

HtmlInputPassword クラスは HtmlInputText クラスから派生しており、ユーザーパスワード入力するための単一テキスト ボックス作成するために使用しますHtmlInputPassword コントロール使用した場合フォーム送信されるたびに Value プロパティサーバーポストバックされますHtmlInputPassword コントロールValue プロパティは、ビューステート保持されません。

MaxLength プロパティは、テキスト ボックス入力できる最大文字数指定しますSize プロパティでは、テキスト ボックスの幅を指定できますValue プロパティは、ユーザーテキスト ボックス入力した値を確認するために使用しますValue プロパティ内容サーバーへのポスト間で変更され場合は、HtmlInputPassword コントロール提供する ServerChange イベント発生します。これにより、イベント発生するたびに命令カスタム セット実行するイベント ハンドラ作成できます

メモメモ

HtmlInputPassword コントロールには、サーバーへのポストバックの手段は組み込まれていません。Web ページに、HtmlButton コントロールや HtmlInputSubmit コントロールなど、サーバーへのポストバックサポートする別のコントロール提供する必要があります

HtmlInputPasswordインスタンス初期プロパティ値の一覧については、HtmlInputPassword コンストラクタトピック参照してください

使用例使用例

Web フォーム ページ<input type=text><input type=password>、および <input type=submit> の各 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  >
  <body>
    <form id="Form1" runat="server">
        &nbsp;&nbsp;

        <p></p><div>Username</div> <br />
        <input type="text" runat="server"
 />

        <p></p><div>Password</div> <br />
        <input type="password" runat="server"
 />

        <p></p><input type="submit"
 runat="server" value="Submit"
 />

    </form>
  </body>
</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  >
  <body>
    <form id="Form1" runat="server">
        &nbsp;&nbsp;

        <p></p><div>Username</div> <br />
        <input type="text" runat="server" />

        <p></p><div>Password</div> <br />
        <input type="password" runat="server" />

        <p></p><input type="submit" runat="server"
 value="Submit" />

    </form>
  </body>
</html>
<%@ Page Language="VJ#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html  >
  <body>
    <form id="Form1" runat="server">
        &nbsp;&nbsp;

        <p></p><div>Username</div> <br />
        <input type="text" runat="server" />

        <p></p><div>Password</div> <br />
        <input type="password" runat="server" />

        <p></p><input type="submit" runat="server"
 value="Submit" />

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

Page_Load メソッド呼び出し中に同じ 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">

  Protected Sub Page_Load(ByVal
 sender As Object, ByVal
 e As EventArgs)
    
    If (IsPostBack) Then
      ' Add code to process the Login.
    End If

  End Sub

  Protected Sub Page_Init(ByVal
 sender As Object, ByVal
 e As System.EventArgs)
    
    Dim userText As HtmlInputText = New
 HtmlInputText
    userText.MaxLength = 20
    Placeholder1.Controls.Add(userText)

    Dim passwordText As HtmlInputPassword =
 New HtmlInputPassword
    passwordText.MaxLength = 20
    Placeholder2.Controls.Add(passwordText)

    Dim submitButton As HtmlInputSubmit = New
 HtmlInputSubmit
    submitButton.Value = "Submit"
    Placeholder3.Controls.Add(submitButton)

  End Sub
</script>

<html  >
  <body>
    <form id="Form1" runat="server">

      <table cellpadding="2">
        <tr>
        <td>User Name
            <asp:placeholder
                runat="server"
                id="Placeholder1" />
        </td></tr>
        <tr>
        <td>Password
            <asp:placeholder
                runat="server"
                id="Placeholder2" />
        </td></tr>
        <tr><td><asp:placeholder
                runat="server"
                id="Placeholder3" />
        </td></tr>
      </table>
    </form>
  </body>
</html>
<%@ 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">
  
  protected void page_load(object sender, EventArgs
 e)
  {
    if (IsPostBack)
    {
      // Add code to process the Login.
    }
  }

  protected void Page_Init(object sender, EventArgs
 e)
  {
    HtmlInputText userText = new HtmlInputText();
    userText.MaxLength = 20;
    Placeholder1.Controls.Add(userText);

    HtmlInputPassword passwordText = new HtmlInputPassword();
    passwordText.MaxLength = 20;
    Placeholder2.Controls.Add(passwordText);

    HtmlInputSubmit submitButton = new HtmlInputSubmit();
    submitButton.Value = "Submit";
    Placeholder3.Controls.Add(submitButton);
  }
</script>

<html  >
  <body>
    <form runat="server">

      <table cellpadding="2">
        <tr>
        <td>User Name
            <asp:placeholder
                runat="server"
                id="Placeholder1" />
        </td></tr>
        <tr>
        <td>Password
            <asp:placeholder
                runat="server"
                id="Placeholder2" />
        </td></tr>
        <tr><td><asp:placeholder
                runat="server"
                id="Placeholder3" />
        </td></tr>
      </table>
    </form>
  </body>
</html>
<%@ Page Language="VJ#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
  
  protected void Page_Load(Object sender, System.EventArgs
 e)
  {
    if (get_IsPostBack())
    {
      // Add code to process the Login.
    }

  }

  protected void Page_Init(Object sender, EventArgs
 e)
  {
    HtmlInputText userText = new HtmlInputText();
    userText.set_MaxLength(20);
    Placeholder1.get_Controls().Add(userText);

    HtmlInputPassword passwordText = new HtmlInputPassword();
    passwordText.set_MaxLength(20);
    Placeholder2.get_Controls().Add(passwordText);

    HtmlInputSubmit submitButton = new HtmlInputSubmit();
    submitButton.set_Value("Submit");
    Placeholder3.get_Controls().Add(submitButton);


  }
</script>

<html  >
  <body>
    <form runat="server">

      <table cellpadding="2">
        <tr>
        <td>User Name
            <asp:placeholder
                runat="server"
                id="Placeholder1" />
        </td></tr>
        <tr>
        <td>Password
            <asp:placeholder
                runat="server"
                id="Placeholder2" />
        </td></tr>
        <tr><td><asp:placeholder
                runat="server"
                id="Placeholder3" />
        </td></tr>
      </table>
    </form>
  </body>
</html>
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.HtmlControls.HtmlControl
       System.Web.UI.HtmlControls.HtmlInputControl
         System.Web.UI.HtmlControls.HtmlInputText
          System.Web.UI.HtmlControls.HtmlInputPassword
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlInputPassword メンバ
System.Web.UI.HtmlControls 名前空間
HtmlInputText
HtmlTextArea
その他の技術情報
HTML サーバー コントロール


このページでは「.NET Framework クラス ライブラリ リファレンス」からHtmlInputPassword クラスを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHtmlInputPassword クラスを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHtmlInputPassword クラス を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HtmlInputPassword クラス」の関連用語

HtmlInputPassword クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HtmlInputPassword クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS