AjaxControlToolkit控件,当然是在Ajax下应用。在aspx页面或母版页中应该要写上:
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
TargetControlID指定要显示信息的控件,WatermarkCssClass指定样式,WatermarkText指定显示的信息。
<asp:TextBox id="txtProject_Name_C" runat="server" Width="250px" MaxLength="35" CssClass="txt"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtProject_Name_C" WatermarkText="请在此处输入工程名称(支持模糊查询)" WatermarkCssClass="watermarked"> </cc1:TextBoxWatermarkExtender>
Css如下:
.watermarked { color:Gray; font-size:small; }
效果图:
原文链接:https://www.f2er.com/ajax/164585.html