TextBoxWatermark Extender (demo)

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 a user with a custom CSS style. Once the user has typed text into the TextBox, the watermarked appearance disappears. The watermark is intended to provide more information to a user about the TextBox without cluttering up the rest of the page.

Properties

Name Description
WatermarkCssClass A CSS class to apply to the TextBox when it has no value (e.g. watermark text is shown)
WatermarkText Text to show when the control has no value

Client properties

text
Text of the target TextBox
Getter name: get_text()
Setter name: set_text(value)

watermarkCssClass
A CSS class to apply to the TextBox when it has no value (e.g. watermark text is shown)
Getter name: get_watermarkCssClass()
Setter name: set_watermarkCssClass(value)

watermarkText
Text to show when the control has no value
Getter name: get_watermarkText()
Setter name: set_watermarkText(value)

Client methods

clearText(focusing)
Clears the text from the target
Params:
  • focusing
    • Type: Boolean
    • Description: Whether or not we are focusing on the textbox

registerPropertyChanged()
A method to call to be assigned to Sys.Preview.UI.TextBox if any
This method must be called manually if Sys.Preview.UI.TextBox is added after TextBoxWatermarkBehavior is initialized

Last edited Sep 14, 2015 at 10:43 AM by fadilmamedov, version 4