How to use TextBox in asp.net

TextBox web server control
TextBox is an asp.net web server control that provide a way for user to type simple text including number and dates. we can use textbox as a single line text input field, multiline text input field and even as password entry field. textbox TextMode property help us to convert textbox from one mode to another mode. TextMode property value Multiline create a multiline textbox that render as a html TextArea control. textbox TextChanged is a very popular event. it's trigger when textbox change it's content and lost it's focus. TextChanged event work with AutoPostBack true mode. asp.net textbox have many useful built in properties to design it programmatically such as BackColor, ForeColor, BorderColor, BorderStyle, BorderWidth, Height, Width, Rows, ToolTip, Wrap, Font etc. Even you can use theme and skin with textbox server control. textbox Text property help to set or get textbox text.
TextBoxHowToUse.aspx

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

<!DOCTYPE html>

<script runat="server">
    protected void Button1_Click(object sender, System.EventArgs e) {
        Label1.Text = "Hello, " +
            TextBox1.Text.ToString() + " " +
            TextBox2.Text.ToString() + "!";
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to use TextBox control in asp.net</title>
</head>
<body style="padding:25px">
    <form id="form1" runat="server">
    <div>
        <h2 style="color:MidnightBlue; font-style:italic;">      
            How to use TextBox control
        </h2>      
        <hr width="450" align="left" color="Gainsboro" />
        <asp:Label 
            ID="Label1" 
            runat="server" 
            Font-Size="X-Large" 
            ForeColor="DarkCyan"
            Font-Names="Courier New"
            Font-Bold="true"
            Font-Italic="true"
            />
        <br /><br />
        <asp:Label 
            ID="Label2" 
            runat="server" 
            Text="First name" 
            AssociatedControlID="TextBox1"
            Font-Bold="true"
            ForeColor="Navy"
            Font-Size="Large"
            />
        <asp:TextBox 
            ID="TextBox1" 
            runat="server"
            Height="35"
            Font-Bold="true"
            BackColor="Gold"
            Font-Size="Large"
            />
        <br /><br />
        <asp:Label 
            ID="Label3" 
            runat="server" 
            Text="Last name" 
            AssociatedControlID="TextBox2"
            Font-Bold="true"
            ForeColor="Navy"
            Font-Size="Large"
            />
        <asp:TextBox 
            ID="TextBox2" 
            runat="server"
            Height="35"
            Font-Bold="true"
            BackColor="Gold"
            Font-Size="Large"
            />
        <br /><br />
        <asp:Button 
            ID="Button1" 
            runat="server" 
            Text="Submit Name" 
            OnClick="Button1_Click"
            Font-Bold="true"
            ForeColor="DodgerBlue"
            Height="45"
            Width="350"
            />
    </div>
    </form>
</body>
</html>
More asp.net examples