views:

1276

answers:

2

I'm creating a login page. I want to create ASP.NET TextBox controls that have "Username" and "Password" as their Text, but as soon as they receive focus, these words should disappear and whatever the user types should appear, just like normal textbox. If the user leaves it blank and tabs to the next textbox, then these words appear again. This will eliminate the need for having separate labels in front of the text boxes. I would appreciate if someone can share their expertise for doing this.

A: 

Google "ASP.NET Watermark textbox". Theres a ton of implemnentations

mattlant
Thank you. I didn't know the keyword "watermark" to search for.
Shankar
+9  A: 

Use the TextBox Watermark Extender that's in Microsoft's AJAX Toolkit.

phloopy
Thank you. After searching (as above) I landed in the AJAX toolkit.
Shankar
nice. glad i could help.
mattlant
No problem. Any reason you unaccepted this answer? It seems a bit more helpful than a suggestion of what to google :p
phloopy
Well, The thing is that googling helps more than a direct answer, as I knew very well that it would lead to what you suggested. Choice is KEY!
mattlant
At least an upvote is deserved :P
mattlant
If google helps more than the answers provided here then stack overflow isn't doing its job. Presumably somebody can figure out adequate google queries from solid answers, but knowing an implemntation that has worked well for somebody else is more valuable.
phloopy