使用jQuery和asp.net创建水印
问题描述:
我想用asp.net和jquery创建水印。我有一个文本框的网页是这样的:使用jQuery和asp.net创建水印
<tr>
<td>
<%=GetLocaleResourceString("Address.FirstName")%>:
</td>
<td>
<nopCommerce:SimpleTextBox runat="server" ID="txtFirstName" Width="165px" class="watermark" Text="Type your First Name"
Tooltip="Type your First Name" ErrorMessage="<% $NopResources:Address.FirstNameIsRequired %>">
</nopCommerce:SimpleTextBox>
<asp:Label ID="lblShippingAddressId" runat="server" Visible="false"></asp:Label>
</td>
</tr>
<tr>
<td>
<%=GetLocaleResourceString("Address.LastName")%>:
</td>
<td>
<nopCommerce:SimpleTextBox runat="server" ID="txtLastName" Width="165px" ErrorMessage="<% $NopResources:Address.LastNameIsRequired %>">
</nopCommerce:SimpleTextBox>
</td>
</tr>
其中nopCommerce:SimpleTextBox是这样的用户控件:
<%@ Control Language="C#" AutoEventWireup="true"
Inherits="NopSolutions.NopCommerce.Web.Modules.SimpleTextBox" Codebehind="SimpleTextBox.ascx.cs" %>
<asp:TextBox ID="txtValue" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvValue" ControlToValidate="txtValue" Font-Name="verdana"
Font-Size="9pt" runat="server" Display="Dynamic">*</asp:RequiredFieldValidator>
我下面这篇文章:
和在使用文本框控件的页面中添加css类和标题(请参阅第一个标记中的标题和css)。
,但是当我看到网页源我得到这个标记:
<input type="text" style="width:165px;" class="textBox" id="ctl00_ctl00_cph1_cph1_ctrlCheckoutSinglePage_ctrlCheckoutBillingAddress_ctrlBillingAddress_txtEmail_txtValue" name="ctl00$ctl00$cph1$cph1$ctrlCheckoutSinglePage$ctrlCheckoutBillingAddress$ctrlBillingAddress$txtEmail$txtValue">
无CSS没有标题添加。请建议我如何添加水印?
问候, 阿西夫·哈米德
答
看来你不应用class="watermark"
为txtValue
<asp:TextBox ID="txtValue" runat="server"></asp:TextBox>
应该
<asp:TextBox ID="txtValue" class="watermark" runat="server"></asp:TextBox>
我申请它的页面,这个文本框控件正在但是当页面呈现时,class =“textBox”被添加。 – DotnetSparrow 2012-07-09 15:04:46