Sunday, March 6, 2011

How to add Ajax Watermark Extender in Apsnet

Hi Friends I would like to explain All the Ajax Toolkit Extenders from this  I am going to explain the Watermark Extender
Before to use the Watermark Extender why we have to use Watermark Extender, the main purpose is it displays the watermark text on the Textbox control .so user can  easily understands what we  have to enter in that textbox

so lets start the how to use Watermark Extender. I already explained about how to integrate Ajax Toolkit to our Asp net application. if you have any doubt regarding integration just click here
So open your first ASP net application and open anyone one of your (.apsx) page.
Here you’re going to integrate Watermark Extender.
Here, I would like to add Watermark Extender to my registration page.
First, Open the source page of Registration page and these two lines otherwise your Ajax will not work.
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>

Next, open the design page of Registration form and add watermark extender for calendar textbox
So op



Just click on Textbox and click on the Add Extender
 

Next, select the Validation Callout Extender from the dialogue box and click ok button

 

Next finally, set the properties of watermark extender


Now code the will be look like this


<asp:TextBox ID="txt_DOB" runat="server" Width="130px"></asp:TextBox>
                <cc1:TextBoxWatermarkExtender ID="txt_DOB_TextBoxWatermarkExtender"
                    runat="server" Enabled="True" TargetControlID="txt_DOB"
                    WatermarkCssClass="watermarked" WatermarkText="dd/mm/yyyy">
                </cc1:TextBoxWatermarkExtender>
                <cc1:CalendarExtender ID="txt_DOB_CalendarExtender" runat="server"
                    Enabled="True" TargetControlID="txt_DOB">
                </cc1:CalendarExtender>

And finally the output will  be look like this

 That’s it Friends……
developercode
About the Author
Sayyad is a Software Engineer, Blogger and Founder of Developers Code from India.His articles mainly focus on .Net (Web and Windows based applications), Mobile Technologies (Android,IPhone,BlackBerry) and SEO.

Labels: , , , , ,

5 Comments:

At March 18, 2011 at 9:02 AM , Blogger Dotnet Tutorials said...

Another Goood article for beginners

 
At March 29, 2011 at 1:42 PM , Blogger Anand Shah said...

I want to Change text of watermark programitically.that is

if(something)
{
txtwatermark.watermarktext = "Something";
}
else
{
txtwatermark.watermarktext = "Nothing";
}
i have done it in this way but it's not working.
:(

 
At March 30, 2011 at 8:42 AM , Blogger Developers Code said...

Hey anand..thanks for sharing.we can also change the water mark text by programmtically..its better to use javascript to change the text.for clear explanation
use this link http://blog.turlov.com/2010/05/how-to-set-programmatically-value-of.html
I hope this will helps you

 
At June 28, 2011 at 10:17 AM , Anonymous Anand said...

I want to Change text of watermark programitically.that is

if(something)
{
txtwatermark.watermarktext = "Something";
}
else
{
txtwatermark.watermarktext = "Nothing";
}
i have done it in this way but it's not working.
:(

 
At June 28, 2011 at 10:17 AM , Anonymous Dotnet Tutorials said...

Another Goood article for beginners

 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home