ASP.NET AJAX TextBox Watermark Control Example

  Uncategorized

 ASP.NET AJAX TextBox Watermark Control Example

<%@ Page Language="C#" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="Ajax" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .WaterMarkClass
        {
            background-color: #EaEaEa;
            border: solid 0.5px #818181;
            padding: 3px;
        }
        .WithOutWaterMark
        {
            border: solid 1.5px #818181;
            padding: 3px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

        <b>First Name:</b>
        <asp:TextBox ID="txtFirstName" runat="server" CssClass="WithOutWaterMark">
        </asp:TextBox>
        <Ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" WatermarkCssClass="WaterMarkClass"
            WatermarkText="Shahrukh" TargetControlID="txtFirstName" runat="server">
        </Ajax:TextBoxWatermarkExtender>
        <br />
        <b>Last Name:</b><asp:TextBox ID="txtLastName" runat="server" CssClass="WithOutWaterMark">
        </asp:TextBox>
        <Ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" WatermarkCssClass="WaterMarkClass"
            WatermarkText="Khan" TargetControlID="txtLastName" runat="server">
        </Ajax:TextBoxWatermarkExtender>
        <br />
    </div>
    </form>
</body>
</html>

 

LEAVE A COMMENT