Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to show hint on text box like water mark inside the textbox. after click on the textbox is must automatically cleared.
Posted
Updated 12-Feb-17 21:46pm
Comments
aarif moh shaikh 4-Jun-15 7:30am    
use Placeholder="Enter Name" on your textbox control
Richard Deeming 4-Jun-15 7:50am    
Is this for ASP.NET, Windows Forms, WPF, or something else?

use text box Placeholder attribute

<asp:TextBox ID="placeholderTextBox" runat="server" placeholder="Enter Your Name"></asp:TextBox>
 
Share this answer
 
Comments
Richard Deeming 4-Jun-15 8:33am    
That's the same solution that Andy posted an hour ago.
Simple :)

ASP.NET
<asp:textbox runat="server" id="txtBox placeholder=""></asp:textbox>



or fro winforms check out this article:

TextBox with Placeholder[^]

WPF XAMP:

XAML only WPF Watermarked TextBox[^] and A WatermarkTextBox in 3 lines of XAML[^]

finally: the heretics on SO have something

http://stackoverflow.com/questions/833943/watermark-hint-text-placeholder-textbox-in-wpf[^]
 
Share this answer
 
v4
Comments
Afzaal Ahmad Zeeshan 4-Jun-15 7:10am    
Are you sure he wanted ASP.NET based solution?
Andy Lanng 4-Jun-15 7:44am    
Fair point well made. - solution updated ^_^
Richard Deeming 4-Jun-15 7:50am    
TextBoxBase could also imply WPF. :)
Andy Lanng 4-Jun-15 8:18am    
I don't know much about WPF, but google does :)

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