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:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</div>
</form>
</body>

Step3: Run the project

Output: 

 

Leave Comment