This documentation is archived and is not being maintained.

HtmlInputText Constructor

.NET Framework 1.1

Initializes a new instance of the HtmlInputText class.

Overload List

Initializes a new instance of the HtmlInputText class using default values.

[Visual Basic] Public Sub New()
[C#] public HtmlInputText();
[C++] public: HtmlInputText();
[JScript] public function HtmlInputText();

Initializes a new instance of the HtmlInputText class using the specified input control type.

[Visual Basic] Public Sub New(String)
[C#] public HtmlInputText(string);
[C++] public: HtmlInputText(String*);
[JScript] public function HtmlInputText(String);

Example

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of the HtmlInputText constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>

<html>
   <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>
  
<body>

   <form 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>
 

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

<html>
   <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>
  
<body>

   <form 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>
 

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

HtmlInputText Class | HtmlInputText Members | System.Web.UI.HtmlControls Namespace

Show: