How to use password mode TextBox in

TextBox TextMode Property Password
ASP.NET TextBox web server control is a simple text input box. But you can change it's text input mode to password input field. TextBox web server control's TextMode property help you to create password input control. Set the TextBox TextMode property value Password, then TextBox will act as a password input TextBox.

Password input TextBox hides user input as it being typed. Password input TextBox can only be single line TextBox. We can get password input TextBox text by collecting TextBox Text property value.

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

<!DOCTYPE html>

<script runat="server">


<html xmlns="">
<head runat="server">
    <title>TextBox example: how to use TextMode property Password</title>
    <form id="form1" runat="server">
        <asp:Label ID="Label1" runat="server" Text="Email" AssociatedControlID="TextBox1"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server" TextMode="SingleLine"></asp:TextBox>
        <br />
        <asp:Label ID="Label2" runat="server" Text="Password" AssociatedControlID="TextBox2"></asp:Label>
        <asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
        <br />
        <asp:Button ID="Button1" runat="server" Text="Login" />
Related examples