HtmlInputText コンストラクター

定義

HtmlInputText クラスの新しいインスタンスを初期化します。

オーバーロード

HtmlInputText()

既定値を使用して HtmlInputText クラスの新しいインスタンスを初期化します。

HtmlInputText(String)

入力コントロール タイプを指定して、HtmlInputText クラスの新しいインスタンスを初期化します。

HtmlInputText()

既定値を使用して HtmlInputText クラスの新しいインスタンスを初期化します。

public:
 HtmlInputText();
public HtmlInputText ();
Public Sub New ()

<%@ Page Language="C#" AutoEventWireup="True" %>

<!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" >
   <script runat="server" >
  
      void Page_Load(Object sender, EventArgs e)
      {

         // Create an HtmlInputText control.
         HtmlInputText text = new HtmlInputText();
         text.Value = "Enter a value.";
         text.MaxLength = 20;
         text.Size = 22;
 
         // Add the control to the Controls collection of the 
         // PlaceHolder control.
         Place.Controls.Clear();
         Place.Controls.Add(text);
         
      }
  
   </script>
  
<head runat="server">
    <title> HtmlInputText Constructor Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> HtmlInputText Constructor Example </h3> 
  
      <asp:PlaceHolder id="Place" runat="server"/>
  
   </form>

</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>

<!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" >
   <script runat="server" >
  
      Sub Page_Load(sender As Object, e As EventArgs)

         ' Create an HtmlInputText control.
         Dim text As HtmlInputText = New HtmlInputText()
         text.Value = "Enter a value."
         text.MaxLength = 20
         text.Size = 22
 
         ' Add the control to the Controls collection of the 
         ' PlaceHolder control.
         Place.Controls.Clear()
         Place.Controls.Add(text)
         
      End Sub
  
   </script>
  
<head runat="server">
    <title> HtmlInputText Constructor Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> HtmlInputText Constructor Example </h3> 
  
      <asp:PlaceHolder id="Place" runat="server"/>
  
   </form>

</body>
</html>

注釈

このコンストラクターを使用して、既定値を使用してコントロールの新しいインスタンスを HtmlInputText 作成および初期化します。 型テキスト ボックス コントロールを text 作成します。

のインスタンスの初期プロパティ値を次の HtmlInputText表に示します。

プロパティ 初期値
Type "text" リテラル文字列。

こちらもご覧ください

適用対象

HtmlInputText(String)

入力コントロール タイプを指定して、HtmlInputText クラスの新しいインスタンスを初期化します。

public:
 HtmlInputText(System::String ^ type);
public HtmlInputText (string type);
new System.Web.UI.HtmlControls.HtmlInputText : string -> System.Web.UI.HtmlControls.HtmlInputText
Public Sub New (type As String)

パラメーター

type
String

入力コントロールのタイプ。

<%@ Page Language="C#" AutoEventWireup="True" %>

<!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" >
   <script runat="server" >
  
      void Page_Load(Object sender, EventArgs e)
      {

         // Create an HtmlInputText control.
         HtmlInputText text = new HtmlInputText("password");
         text.MaxLength = 20;
         text.Size = 22;
 
         // Add the control to the Controls collection of the 
         // PlaceHolder control.
         Place.Controls.Clear();
         Place.Controls.Add(text);
         
      }

      void Button_Click(Object sender, EventArgs e)
      {

         // Insert secure authentication here.
         // Make sure to use SSL to secure the connection.

      }
  
   </script>
  
<head runat="server">
    <title> HtmlInputText Constructor Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> HtmlInputText Constructor Example </h3> 
  
      Enter your password: <br />
      <asp:PlaceHolder id="Place" runat="server"/>

      <br /><br />
 
      <input type="submit"
             value="Submit"
             onserverclick="Button_Click" 
             runat="server"/> 
  
   </form>

</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>

<!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" >
   <script runat="server" >
  
      Sub Page_Load(sender As Object, e As EventArgs)

         ' Create an HtmlInputText control.
         Dim text As HtmlInputText = New HtmlInputText("password")
         text.MaxLength = 20
         text.Size = 22
 
         ' Add the control to the Controls collection of the 
         ' PlaceHolder control.
         Place.Controls.Clear()
         Place.Controls.Add(text)
         
      End Sub

      Sub Button_Click(sender As Object, e As EventArgs)

         ' Insert secure authentication here.
         ' Make sure to use SSL to secure the connection.

      End Sub
  
   </script>
  
<head runat="server">
    <title> HtmlInputText Constructor Example </title>
</head>
<body>

   <form id="form1" runat="server">
  
      <h3> HtmlInputText Constructor Example </h3> 
  
      Enter your password: <br />
      <asp:PlaceHolder id="Place" runat="server"/>

      <br /><br />
 
      <input type="submit"
             value="Submit"
             onserverclick="Button_Click" 
             runat="server"/> 
  
   </form>

</body>
</html>

注釈

このコンストラクターを使用して、指定した入力コントロール型を使用してコントロールの HtmlInputText 新しいインスタンスを作成および初期化します。 これにより、 などの password特定の種類のテキスト ボックス コントロールを作成できます。 または 型passwordtextのみが現在サポートされています。 このコンストラクターは、他のテキスト ボックス型が使用可能になった場合に作成できるように設計されています。

のインスタンスの初期プロパティ値を次の HtmlInputText表に示します。

プロパティ 初期値
Type type パラメーターの値。

Note

このコンストラクターを使用して型テキスト ボックス コントロールを text 作成できますが、パラメーターなしのコンストラクターは通常代わりに使用されます。

こちらもご覧ください

適用対象