Saturday, March 10, 2012

Use TextBoxWatermarkExtender and CalendarExtender on the same TextBox

Yes, Calendar could be looking for TextBoxWatermark and calling its set_Text() method. Pleaseopen a work item to report and track this issue. Thank you!

Thanks for the response. I've opened a work item as you suggested:http://www.codeplex.com/AtlasControlToolkit/WorkItem/View.aspx?WorkItemId=7704

I think it would be better to implement a solution in the TextBoxWatermark extender, so that it removes its watermark when the textbox text is set programatically from any other extender - e.g. the PopupControl.


It's a good idea, but I don't think TextBoxWatermark can't always tell when something else has changed the textbox text. :(

> I don't think TextBoxWatermark can't always tell when something else has changed the textbox text. :(

OK I'd thought it would have been able to do something by handling the textbox's change event (obviously ignoring changes made by the TextBoxExtender itself).

If that's not the case, the mechanism for notifying the TextBoxWatermarkExtender that it should remove its watermark should be documented so it can be used by controls other than Calendar (e.g. PopupControl or other third party extender).


> I don't think TextBoxWatermark can't always tell when something else has changed the textbox text.

I experimented with adding a handler for the textbox's change event to TextBoxWatermark.js and it seems to work fine.

Basically in the change event hander, just test if the textbox's value is equal to an empty string or the watermark text, and if so apply the watermark else remove it.


Great to know - thanks for trying this out! My statement was based on the fact that event handlers don't fire when script modifies the contents of controls - so I was curious why it worked for you. It turns out that Calendar has a _fireChanged method which manually fires the onchange event on the textbox. So your solution works in this case and is probably worth implementing - but I'm still not sure it's a 100% general solution. Thanks again!

I have the same problem,,

my calendar is for a textbox not for a popUp ,, can any one explain to me the solution in some details,,

How can I remove the watermark effect,,I want to remove it when choosing a date

thanks

No comments:

Post a Comment