Ramani Sandeep's Blog

DotNetting – Fast , Easy Way of Developing Applications

AJAX – TextBoxWatermark

Posted by Ramani Sandeep on November 21, 2008

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

<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).

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>