Home / AJAX

Ajax Control Toolkit TextBoxWatermark

RSS
Modified on 2010/04/16 01:16 by Stephen Walther Categorized as Uncategorized
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.

WatermarkTextBox Server Properties

The properties in italics 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).