Export (0) Print
Expand All

HtmlInputText Constructor

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

Namespace:  System.Web.UI.HtmlControls
Assembly:  System.Web (in System.Web.dll)

public HtmlInputText()

Use this constructor to create and initialize a new instance of the HtmlInputText control using default values. It creates a text type text box control.

The following table shows the initial property value for an instance of HtmlInputText.


Initial Value


The "text" literal string.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<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.



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

   <form id="form1" runat="server">

      <h3> HtmlInputText Constructor Example </h3> 

      <asp:PlaceHolder id="Place" runat="server"/>



.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft