Share via


HtmlInputText 생성자

정의

HtmlInputText 클래스의 새 인스턴스를 초기화합니다.

오버로드

HtmlInputText()

기본값을 사용하여 HtmlInputText 클래스의 새 인스턴스를 초기화합니다.

HtmlInputText(String)

지정된 input 컨트롤 형식을 사용하여 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)

지정된 input 컨트롤 형식을 사용하여 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특정 유형의 텍스트 상자 컨트롤을 만들 수 있습니다. password 또는 text 형식만 현재 지원됩니다. 이 생성자는 사용할 수 있는 경우 다른 텍스트 상자 형식을 만들 수 있도록 설계되었습니다.

다음 표에서 인스턴스에 대 한 초기 속성 값을 HtmlInputText입니다.

속성 초기 값
Type type 매개 변수의 값입니다.

참고

이 생성자를 사용하여 형식 텍스트 상자 컨트롤을 text 만들 수 있지만 매개 변수가 없는 생성자는 일반적으로 대신 사용됩니다.

추가 정보

적용 대상