Wednesday, March 28, 2012

Change WatermarkText in VB code behind

I would like to be able to change the WatermarkText in my VB.NET code.

<atlasToolkit:TextBoxWatermarkExtender ID="txtWMEAddress1" runat="server">
<atlasToolkit:TextBoxWatermarkProperties TargetControlID="txtAddress1" WatermarkText="test" WatermarkCssClass="WaterMark" />
</atlasToolkit:TextBoxWatermarkExtender>

Your help is appreciated.

Thank you

it's really as easy as saying:

txtWMEAddress1.WatermarkText =

"Text from code behind"


I tried that before I put up the original posting.

There is no direct property of a TextBoxWatermarkExtender called"WatermarkText".

There is a separate tag called TextBoxWatermarkProperties, but does not have an ID or a runat to access it from the code behind.

The syntax should be (I think) txtWMEFirstName.<access TextBoxWatermarkProperties>.WatermarkText = "My text"

<atlasToolkit:TextBoxWatermarkExtender ID="txtWMEFirstName" runat="server">
<atlasToolkit:TextBoxWatermarkProperties TargetControlID="txtFirstName" WatermarkText="First Name" WatermarkCssClass="WaterMark" />
</atlasToolkit:TextBoxWatermarkExtender>

How should I be doing this?

Thank you very much.


Your code seem to be using pre-beta code of ASP.NET Ajax. Is there any reason why you are still using that version. In the current version of ASP.NET Ajax there is no separate TextBoxWatermarkProperties, instead TextBoxWatermarkExtender has the WaterMarkText property.

No comments:

Post a Comment