Using ASP .NET TextBoxWaterMark Extender

Source Code:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="tWtr.aspx.vb" Inherits="tWtr" %>
<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">

.watermark
{
   background-repeat: no-repeat;
   padding-left: 20px;
   vertical-align: middle;
   color: DarkGray;
}
.normal
{
}
</style> 
</head>
<body>
    <form id="form1" runat="server">
      <ajax:ToolkitScriptManager ID="tl" runat="server"></ajax:ToolkitScriptManager>
<asp:Panel ID="pnl" runat="server">
<asp:TextBox ID="txt1" runat="server"></asp:TextBox>
<br />
<asp:TextBox ID="txt2" runat="server"></asp:TextBox>
<br />
<asp:Label ID="lbl" runat="server"></asp:Label>
<asp:Button ID="btn" runat="server" Text="Click Me" />
</asp:Panel>
<ajax:TextBoxWatermarkExtender ID="txtwter" runat="server"
 TargetControlID="txt1" WatermarkText="Enter Your First Name"
  WatermarkCssClass="watermark"></ajax:TextBoxWatermarkExtender>
  <ajax:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
 TargetControlID="txt2" WatermarkText="Enter Your Last Name"
  WatermarkCssClass="watermark"></ajax:TextBoxWatermarkExtender>
 
    </form>
</body>
</html>


VB Code:

Partial Class tWtr
    Inherits System.Web.UI.Page

    Protected Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click
        lbl.Text = txt1.Text & " " & txt2.Text
    End Sub
End Class


Thanks
Ebook Download
View all
Learn
View all