Showing posts with label runat. Show all posts
Showing posts with label runat. Show all posts

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.

Change className with AnimationExtender

I have been trying to use ScriptAction to change the class

<ajaxToolkit:AnimationExtender ID="webAni" runat="server" TargetControlID="webBut">
<Animations>
<OnClick>
<Sequence>
<ScriptAction Script="document.getElementById('webBut').className='servSel';" />
<StyleAction AnimationTarget="infoHolder" Attribute="display" Value="block" />
</Sequence>
</OnClick>
</Animations>
</ajaxToolkit:AnimationExtender>

This does not work.

I also tried <ScriptAction Script="alert(document.getElementById('webBut').className);" /> to see if it returns name of class. No box appears. Oh and also tried using $get('webBut').className='servSel';

Any ideas? What am i doing wrong?


Rick

I figured it out. The page has a masterpage and the id was changed.