in zip file you will get dll and samplesite(examples for using all controls)
in toolbox right click add tab name it "AJAX" and click choose items then browse to downlodeded dll, select it many controls will be added to you toolbox then use watermark extender from toolbox.
if any problem ask me i will explain more with code
If you feel helped. Please mark this post as Answer
anas if after clicking in textbox and then without typing in textbox, if we focus to next control. 0 will not be regained automaticalyy but watermark will do that .
If you feel helped. Please mark this post as Answer
anas if after clicking in textbox and then without typing in textbox, if we focus to next control. 0 will not be regained automaticalyy but watermark will do that .
S-Yandel
Member
4 Points
19 Posts
TextBox
Mar 31, 2012 10:21 AM|LINK
Hi,
I want a TextBox to have an intial value of 0.
but when the user clicks it the text box should be blank.
i've put 0 in the text property field so far
Thanks
Sahil P
tdmca
Contributor
2396 Points
661 Posts
Re: TextBox
Mar 31, 2012 10:22 AM|LINK
dear that is property of watermark
use watermark from ajax toolkit
download ajax toolkit and use watermark for textbox
S-Yandel
Member
4 Points
19 Posts
Re: TextBox
Mar 31, 2012 10:25 AM|LINK
yeah this is just for a simple website.
how would i go about it?
ramiramilu
All-Star
98023 Points
14516 Posts
Re: TextBox
Mar 31, 2012 10:28 AM|LINK
jquery simple watermark - http://www.davidjrush.com/blog/2011/01/javascript-creating-a-simple-textbox-watermark-with-text/
Thanks,
JumpStart
tdmca
Contributor
2396 Points
661 Posts
Re: TextBox
Mar 31, 2012 10:28 AM|LINK
Download ajaxtoolkit from ASP.NET site
in zip file you will get dll and samplesite(examples for using all controls)
in toolbox right click add tab name it "AJAX" and click choose items then browse to downlodeded dll, select it many controls will be added to you toolbox then use watermark extender from toolbox.
if any problem ask me i will explain more with code
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: TextBox
Mar 31, 2012 10:29 AM|LINK
Here is the simplest way:
S-Yandel
Member
4 Points
19 Posts
Re: TextBox
Mar 31, 2012 10:31 AM|LINK
cheers
knew there was a simpler way.
Thanks !
tdmca
Contributor
2396 Points
661 Posts
Re: TextBox
Mar 31, 2012 10:32 AM|LINK
anas if after clicking in textbox and then without typing in textbox, if we focus to next control. 0 will not be regained automaticalyy but watermark will do that .
madan535
Contributor
3229 Points
1180 Posts
Re: TextBox
Mar 31, 2012 10:34 AM|LINK
Here is another way
<asp:TextBox ID="TextBox1" runat="server" Text = "Enter your text here" ForeColor = "Gray" onblur = "WaterMark(this, event);" onfocus = "WaterMark(this, event);"> </asp:TextBox><script type = "text/javascript"> var defaultText = "Enter your text here"; function WaterMark(txt, evt) { if(txt.value.length == 0 && evt.type == "blur") { txt.style.color = "gray"; txt.value = defaultText; } if(txt.value == defaultText && evt.type == "focus") { txt.style.color = "black"; txt.value=""; } } </script>In code behind add these code in the page load
TextBox1.Attributes.Add("onblur", "WaterMark(this, event);"); TextBox1.Attributes.Add("onfocus", "WaterMark(this, event);");Or Else use Ajax Water Mark Extender
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/TextBoxWatermark/TextBoxWatermark.aspx
http://www.datasprings.com/resources/articles-information/ajax-textboxwatermark-control
http://www.ezzylearning.com/tutorial.aspx?tid=7259638
http://www.c-sharpcorner.com/uploadfile/rahul4_saxena/ajax-text-box-watermark-extender/
anas
All-Star
73649 Points
7914 Posts
Moderator
Re: TextBox
Mar 31, 2012 10:38 AM|LINK
Handling the "onblur" event will do the trick:
<asp:TextBox ID="TextBox1" runat="server" Text="0" onclick="javascript:if(this.value=='0') this.value=''" onblur="javascript:if(this.value=='') this.value='0'" ></asp:TextBox>