TextBoxWatermark控件,該控件用於當控件處於非焦點時的提示內容。
<%...@ Page Language="C#" AutoEventWireup="true" CodeFile="TextboxWatermarkDemo.ASPx.cs"
Inherits="TextboxWatermarkDemo" %>
<%...@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="ASP" %>
<%...@ Register Assembly="AjaxControlToolkit" Namespace="AJaxControlToolkit" TagPrefix="cc1" %>
<!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>無標題頁</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ASP:ScriptManager ID="ScriptManager1" runat="server">
</ASP:ScriptManager>
<ASP:UpdatePanel ID="UpdatePanel1" runat="server">
&nb
sp; <ContentTemplate>
用戶名:
<ASP:TextBox ID="TextBox1" CSSClass="unwatermarked" Width="150" runat="server">
</ASP:TextBox>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server"
TargetControlID="TextBox1" WatermarkText="請輸入用戶名" />
<br />
密碼:
<ASP:TextBox ID="TextBox2" CSSClass="unwatermarked" Width="150" runat="server">
</ASP:TextBox>
<cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" runat="server"
TargetControlID="TextBox2" WatermarkText="請輸入密碼" />
<br />
<br />
</ContentTemplate>
</ASP:UpdatePanel>
</div>
</form>
</body>
</Html>