You can render the TextBox control to as password type by setting its TextMode property to Password. The next test .aspx page shows this:

C# in Depth, 3rd EditionBest VPN app


<%@ Page Language=”vb” AutoEventWireup=”false” CodeBehind=”TextBoxAsPassword.aspx.vb”

Inherits=”TextBoxSamplesVB.TextBoxAsPassword” %>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”>

<html xmlns=””>

<head runat=”server”>

<title>Password type TextBox</title>



<form id=”form1″ runat=”server”>


<asp:TextBox ID=”tbPassword” runat=”server” TextMode=”Password”></asp:TextBox>