articles

Home / DeveloperSection / Articles / ASP.Net AJAX Server Control: TextBoxWatermarkExtender

ASP.Net AJAX Server Control: TextBoxWatermarkExtender

Amit Singh 11219 03-Oct-2010
TextBoxWaterMarkExtender:

This control allows you to put instructions in the textbox control. This gives them a better understanding of what to use the control for. It control have main properties as TargetControlID, WatermarkText, WatermarkCssClass etc.How we implement the TextBoxWaterMarkExtender

Example:

Step1: we use the following control on aspx page 

 <head runat="server">
    <title>TextBoxWatermarkExtender</title>
    <style>
    .TextWatermarkCss
    {
      color:Gray;
      font-style:italic;
      font-family:Calibri;
    }
    </style>
</head>
<body>
<form id="form1" runat="server">
<div>
<%--Using ScriptManager or ToolkitScriptManager according toolkit version--%>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<%-- add the TextBoxWatermarkExtender and textbox--%>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
TargetControlID="TextBox1" WatermarkText="Enter Text Here" WatermarkCssClass="TextWatermarkCss">
</cc1:TextBoxWatermarkExtender>
<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox>
</div>
</form>
</body>

Step3: Run the project

Output: 

ASP.Net AJAX Server Control: TextBoxWatermarkExtender

 


Updated 13-Nov-2019

Leave Comment

Comments

Liked By