hi,
i have a username and password textbox. they start off saying username and password in a grey text. what i want to happen is when the user clicks in them the text in them disappears and the user can type in them, however if they are clicked out of before anything is typed the original text reappears. also in the username textbox i want the text that the user types in to be black, and in the password textbox i want the password circles to appear when the user types in their password.
for an example i want them to work exactly like the email and password textboxes on facebook.
im pretty lost on how to do this, not the best at c# yet.
thank you so much for any help on this!!!
10 Replies - 7598 Views - Last Post: 10 March 2010 - 08:50 PM
Replies To: How to change text in textbox when it is clicked?
#2
Re: How to change text in textbox when it is clicked?
Posted 09 March 2010 - 09:34 PM
You can use the Enter event of the textbox, then set the Text property of the textbox to string.Empty
#3
Re: How to change text in textbox when it is clicked?
Posted 09 March 2010 - 09:48 PM
the only thing is its an asp.net application, and when i click for the list of events it only has has a few of the events that are there on a windows form application (Enter is not there). instead of clicking on Enter from the list of events, will it work if i just type it in in source code.
sorry if i sound stupid and/or not making sense first time ive messed with an asp.net app, and little programming experience period.
sorry if i sound stupid and/or not making sense first time ive messed with an asp.net app, and little programming experience period.
#4
Re: How to change text in textbox when it is clicked?
Posted 09 March 2010 - 09:55 PM
acually yea i just tried what u said in a windows form application and it worked, however it wont work in my asp.net application...any idea why and how i can make it work?
thanks!
thanks!
#5
Re: How to change text in textbox when it is clicked?
Posted 10 March 2010 - 04:32 AM
#6
Re: How to change text in textbox when it is clicked?
Posted 10 March 2010 - 01:51 PM
Thanks alot man! I just have 2 more questions. I want the text in the watermark to be light grey. i saw on the link you gave me, he gave his a colored background, but i think he used a CSS sheet for that. Is there an easier way i can do that in VS? I tried typing in the hexidecimal next to the watermartk text property, but it didnt work. also for my password textbox, how can i make it so dots show up?
Thanks Alot!!!
Thanks Alot!!!
#7
Re: How to change text in textbox when it is clicked?
Posted 10 March 2010 - 01:59 PM
For the watermarked text color, you will need to use CSS. I don't think it's possible to change that without using CSS. CSS is easy.
After adding a stylesheet to your project, add this to the stylesheet...
Then for the TextBoxWatermarkExtender, you would do this...
Here is a like of grey colors in HEX. Just find the color that you want and replace the HEX in the CSS with the color that you want.
http://www.december....pec/color0.html
For the password, set the TextMode property of the textbox to Password.
After adding a stylesheet to your project, add this to the stylesheet...
.WatermarkTextbox
{
color: #E8E8E8;
}
Then for the TextBoxWatermarkExtender, you would do this...
<ajaxToolkit:TextBoxWatermarkExtender ID="TBWE2" runat="server"
TargetControlID="TextBox1"
WatermarkText="Type First Name Here"
WatermarkCssClass="WatermarkTextbox" />
Here is a like of grey colors in HEX. Just find the color that you want and replace the HEX in the CSS with the color that you want.
http://www.december....pec/color0.html
For the password, set the TextMode property of the textbox to Password.
This post has been edited by eclipsed4utoo: 10 March 2010 - 02:04 PM
#8
Re: How to change text in textbox when it is clicked?
Posted 10 March 2010 - 02:29 PM
sorry about all the questions lol...last one!!(i think)
when i changed the textmode property to password it also changed my watermark text to dots...any idea how to get around this.
thanks!
when i changed the textmode property to password it also changed my watermark text to dots...any idea how to get around this.
thanks!
#9
Re: How to change text in textbox when it is clicked?
Posted 10 March 2010 - 02:51 PM
I don't think it's possible.
This post has been edited by eclipsed4utoo: 10 March 2010 - 02:55 PM
#10
Re: How to change text in textbox when it is clicked?
Posted 10 March 2010 - 03:12 PM
I will take that back. I would assume it's possible using Javascript. You can use javascript to determine when the textbox has focus, and then set the textbox's TextMode to password. I only assume this is possible. I have NOT done this myself.
#11
Re: How to change text in textbox when it is clicked?
Posted 10 March 2010 - 08:50 PM
ok. thanks for all the help...man who would have thought there could be so much trouble with a simple textbox!
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|