TextBoxWatermark (watermark text box) control in the AJAX control set, asp. netajax Control
Function:
The TextBox Control can have the watermark text during initialization.
Attribute:
TargetControlID: ID of the TextBox Control with watermark effect.
WatermarkCssClass: Specifies the CSS style sheet of the watermark text.
WatermarkText: the watermark text content displayed in the TextBox Control.
Code example:
<Asp: Panel ID = "panIntTemp" runat = "server" GroupingText = "add materials"> <table> <tr> <td> Name: </td> <asp: TextBox ID = "txtIntName" runat = "server"> </asp: TextBox> <ajaxToolkit: textBoxWatermarkExtender ID = "tbweTxtIntName" runat = "server" TargetControlID = "txtIntName" WatermarkCssClass = "watermarked" WatermarkText = "enter your name here"> </ajaxToolkit: textBoxWatermarkExtender> </td> <td> Gender: </td> <asp: TextBox ID = "txtIntGender" runat = "server"> </asp: textBox> <ajaxToolkit: TextBoxWatermarkExtender ID = "tbweTxtIntGender" runat = "server" TargetControlID = "txtIntGender" WatermarkText = "enter a gender here"> </ajaxToolkit: textBoxWatermarkExtender> </td> <tr> <td> Date of Birth: </td> <asp: textBox ID = "txtIntBirthday" runat = "server"> </asp: TextBox> <ajaxToolkit: textBoxWatermarkExtender ID = "tbweTxtIntBirthday" runat = "server" TargetControlID = "txtIntBirthday" WatermarkCssClass = "watermarked" WatermarkText = "YYYYMMDD"> </ajaxToolkit: textBoxWatermarkExtender> </td> <td> Home address: </td> <asp: TextBox ID = "txtIntAddress" runat = "server"> </asp: textBox> <ajaxToolkit: TextBoxWatermarkExtender ID = "tbweTxtIntAddress" runat = "server" TargetControlID = "txtIntAddress" WatermarkText = "enter your home address"> </ajaxToolkit: textBoxWatermarkExtender> </td> </tr> </table> </asp: Panel>View Code
Run:
The name and date of birth indicate the effect displayed in the CSS style sheet of the watermark text. This is very practical in actual programming.
As follows:
End:
This chapter describes how to use TextBoxWatermarkExtender. This component is easy to use and can be used without writing any code. Or some friends may think that setting a default value for TextBox can also serve as a prompt. The default value can only be used to set simple text, but cannot set the prompt style. When the input content is cleared again, the prompt cannot appear again unless it is assisted by js. TextBoxWatermarkExtender allows you to achieve the desired effect with the fastest speed.
In VS2008, when AJAX control is used, does it not produce any effect after running?
<Asp: TextBox ID = "txtDeptSearch" runat = "server"> </asp: TextBox> <ajaxToolkit: textBoxWatermarkExtender ID = "txtDeptSearch_TextBoxWatermarkExtender" runat = "server" Enabled = "true" TargetControlID = "txtDeptSearch" WatermarkText = "Enter the Department name to search! "SkinID =" TextBoxWatermarkExtender "> </ajaxToolkit: TextBoxWatermarkExtender>
How can I use TextBoxWatermarkExtender1, a watermark control in AjaxControlToolkit?