Click here to Skip to main content
15,921,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a Text box. in the text box by default will be show 'please enter your email id' and when user enter any word the text is remove and user test will be show. if the user does not write any thing the default text will be show.
Posted

 
Share this answer
 
Try this code:
C#
<asp:TextBox ID="TextBox1" runat="server" value="please enter your email id" onclick="if(this.value=='please enter your email id'){this.value=''}" onblur="if(this.value==''){this.value='please enter your email id'}"></asp:TextBox>
 
Share this answer
 
v2
<asp:TextBox ID="txtMsg" runat="server" TextMode="MultiLine" placeholder="Message"></asp:TextBox>

you can also use placeholder for this purpose for e.g i have use Message as a watermark text here.
 
Share this answer
 
v3
use placeholder

example:
placeholder="Please enter your email id"
 
Share this answer
 
If you want to do this in a webpage than you can use watermark textbox of AJAX. It will give a great look an functionality rather than a normal textbox.
Check this out :- Check This [^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900