I’m using a TextBoxWatermarkExtender on a TextBox, and it’s working almost perfectly. The functionality is there: placeholder text that disappears when other text is entered or the TextBox has focus. However, it only seems to be able to load one CSS class, which is the class of the TexBox. I’m working with team code, and elsewhere in the solution is a TextBoxWatermarkExtender that uses a class different from the text box it’s attached to, so I know it’s possible. What happens is that the TextBoxWatermarkExtender seems to use its default CSS, which I can’t have. Relevent code is below, let me know if you need anything else from me.
Code for TextBoxWatermarkExtender:
<asp:RadioButton id="FunctionalityTypeText" GroupName="FunctionalityTypes" runat="server"/>
<asp:TextBox runat="server" id="tbFunctionalities" CssClass="AddTaskForceDetails" MaxLength="240"></asp:TextBox>
<AjaxControlToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2"
runat="server" TargetControlID="tbFunctionalities"
WatermarkText="Custom..." WatermarkCssClass="AddTaskForceDetails"/>
CSS Class that works:
.AddTaskForceDetails
{
width: 425px;
margin: 5px;
}
CSS Class I want to use:
.Watermark
{
width: 425px;
margin: 5px;
color: Gray;
}
Well, I’m not sure what was going on, but my TextBoxWatermarkExtender works properly now. The form it was a part of had its own CSS, and the main solution wasn’t loading the CSS each time. Loading the form ASPX file in the browser on its own showed the updated CSS, and the next time I ran the solution the CSS persisted. So, Tim, thanks for your suggestion, but I guess it was just luck that solved this problem.