Ajax Control Toolkit

TextBoxWatermark Demonstration
First name:
Last name:



Hello [blank] [blank]!
TextBoxWatermark Description

TextBoxWatermark is an ASP.NET AJAX extender that can be attached to an ASP.NET TextBox control to get "watermark" behavior. When a watermarked TextBox is empty, it displays a message to the user with a custom CSS style. Once the user has typed some text into the TextBox, the watermarked appearance goes away. The typical purpose of a watermark is to provide more information to the user about the TextBox itself without cluttering up the rest of the page.

TextBoxWatermark Properties

The control above is initialized with this code. The italic properties are optional:

<ajaxToolkit:TextBoxWatermarkExtender ID="TBWE2" runat="server"
    TargetControlID="TextBox1"
    WatermarkText="Type First Name Here"
    WatermarkCssClass="watermarked" />
  • TargetControlID - The ID of the TextBox to operate on
  • WatermarkText - The text to show when the control has no value
  • WatermarkCssClass - The CSS class to apply to the TextBox when it has no value (e.g. the watermark text is shown).