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.
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).
|
How Do I: Use the ASP.NET AJAX TextBoxWatermark Control Extender?
In this video you will learn how to use the TextBoxWatermark control extender from the ASP.NET AJAX Control Toolkit, which adds new watermark properties to all standard TextBox controls on an ASP.NET page.
Watch the Video
|