A Simple AJAX control in ASP.NET 2.0 and C#
Introduction
In this article I will explain how you can easily create an AJAX enabled web site within Visual Studio 2005 utilizing C# and how to utilize the AJAX framework to add a simple control from the list of controls available in the AJAX Control Toolkit.
The AJAX control we will be working with in this article is the “PasswordStrength” control. As mentioned above this control is in the AJAX Control Toolkit we installed in the previous article of this series. We will also learn that the PasswordStrength control can easily secure passwords as they are being entered and notify the user real time as to what else they need to add to their password in order for it to meet your requirements.
In the previous article we learned the following about AJAX and what you can with it?
“ASP.NET AJAX is a free framework for quickly creating efficient and interactive Web applications that work across all popular browsers.”
We migrated our web sites to Server Intellect over one weekend and the setup was so smooth that we were up and running right away. They assisted us with everything we needed to do for all of our applications. With Server Intellect's help, we were able to avoid any headaches!
ASP.NET AJAX:
- Create interfaces with AJAX components that can be reused.
- Upgrade your existing pages with AJAX controls.
- AJAX comes with support for all modern browsers
- AJAX comes as part of Visual Studio 2008 and does not need to be downloaded and installed as in Visual Studio 2005.
What we will learn in this article:
- How to Create an AJAX enabled Web Site
- How to utilize the PasswordStrength control
Please Note:
AJAX functionality is integrated in ASP.NET 3.5 and does not require any additional downloads. If you are using ASP.NET 3.5 this article does not apply to you.
Getting Started with our AJAX Application
Before we begin coding we will need to download the AJAX framework and install it onto our system in order to have the framework available for us to create our first AJAX web project.
In our previous article titled “Getting Started with AJAX, ASP.NET 2.0 and C#“ we went through the steps involved to install AJAX and how to AJAX enable Visual Studio. We explained where to go to find out about AJAX and that you could download step by step tutorials that will guide you through using every control within the AJAX Control Toolkit.
Here is the AJAX web site for you to add to your bookmarks in your favorite browser:
http://www.asp.net/
Configure Visual Studio 2005
- The first step in our process is to create a new web site from the ASP.NET AJAX web site template by opening the "File" menu, and clicking "New Web Site...", and selecting the "ASP.NET AJAX-Enabled Web Site" under "Visual Studio Installed Templates".
We moved our web sites to Server Intellect and have found them to be incredibly professional. Their setup is very easy and we were up and running in no time.
Fig. 1
- You will be presented with the following “Default.aspx.cs” generated file. You will notice that there is a reference to a control called ScriptManager and that there is a ScriptManager control on the form called “ScriptManager1”. This is a required control for the AJAX framework and when it is needed this control will always be generated and added to your form as you drop AJAX controls onto your form.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
</div>
</form>
</body>
</html>
- The next step is to add the TextBox that we will be using for entering the password. This is also the “TargetControlID” of the PasswordStrength control. Meaning that we are extending the TextBox control with the PasswordStrength functionality.
<asp:TextBox ID="TextBox1" runat="server" Width="204px"></asp:TextBox>
- The next step is to add the label that will hold the help text as we are typing the password. This is a real time display and is constantly changing based on your keystrokes entered into the TextBox.
Need help with Windows Dedicated Hosting? Try Server Intellect. I'm a happy customer!
<asp:Label ID="Label1" runat="server" Width="204px" ></asp:Label><br />
- The next step is to drop the PasswordStrength control onto your web page. We do that by adding the following entry into the Markup.
<cc1:PasswordStrength ID="PasswordStrength2" runat="server"
TextCssClass="TextIndicator_TextBox1"
HelpStatusLabelID="Label1"
MinimumNumericCharacters="1"
MinimumSymbolCharacters="1"
DisplayPosition="RightSide"
PreferredPasswordLength="6"
RequiresUpperAndLowerCaseCharacters="True"
StrengthIndicatorType="Text"
TargetControlID="TextBox1"
TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent">
</cc1:PasswordStrength>
The properties in the above code example do not reflect the entire list of properties available for this control. These are the properties that we are using for this example to give you an insight on how to use this control.
PasswordStrength Properties
TextCssClass="TextIndicator_TextBox1"
HelpStatusLabelID="Label1"
MinimumNumericCharacters="1"
I just signed up at Server Intellect and couldn't be more pleased with my Windows Server! Check it out and see for yourself.
MinimumSymbolCharacters="1"
DisplayPosition="RightSide"
PreferredPasswordLength="6"
RequiresUpperAndLowerCaseCharacters="True"
StrengthIndicatorType="Text"
TargetControlID="TextBox1"
TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent">
Server Intellect offers Windows Hosting Dedicated Servers at affordable prices. I'm very pleased!
We have now covered all of the pertinent points of using the PasswordStrength control within the AJAX Control Toolkit. We are ready to run our example and see how the application works. The following screen shot will show what the application will look like.
What our example application will look like
Fig. 2

What we have Learned
We have learned that we can easily create an AJAX enabled web site and that we can add AJAX controls to it very easily. In our example we added the PasswordStrength control and explained how we can now display easy to follow visual aids with our password controls.
Attachments
I use this site frequently and so should you, go to www.asp.net. Their reference material was very helpful when it came to researching this article.
Attachments



Leave a Comment
#1 Shweta
Posted By: Shweta | 9.30.2008 at 1:57 AM
nice article. help me but i want to know the proper steps of making vs 2.0 website AJAX enabled
#2 pradeep
Posted By: pradeep | 12.12.2008 at 2:20 AM
interesting
#3 Shivani
Posted By: Shivani | 2.07.2009 at 12:48 AM
Very Good !
Great Help me
#4 Ashok Kumar Jangir
Posted By: Ashok Kumar Jangir | 7.20.2009 at 4:46 AM
very nice, and understable easily, but i want to know more steps of C# 2.0 with Ajax
#5 mohan
Posted By: mohan | 11.01.2009 at 12:52 AM
fzgb
#6 online games
Posted By: online games | 11.24.2009 at 11:07 PM
nice article. help me but i want to know the proper steps of making vs 2.0 website AJAX enabled
#7 Hunting Rifles in Virginia
Posted By: Hunting Rifles in Virginia | 1.06.2010 at 12:57 AM
I've already bookmark this article and I'll definitely refer this to all my professional colleagues.
#8 shri
Posted By: shri | 2.03.2010 at 4:31 AM
excellent!
#9 shri
Posted By: shri | 2.03.2010 at 4:31 AM
Exellent!
#10 online dressup games
Posted By: online dressup games | 3.07.2010 at 3:43 AM
Brilliant article..
#11 220-702 exam
Posted By: 220-702 exam | 3.19.2010 at 5:43 AM
For all I know this could be a really old entry, since there are no date marker on the article. In that case I apologize.
#12 meilleure strategie des casinos
Posted By: meilleure strategie des casinos | 4.02.2010 at 5:59 AM
i finished the article, i started disliking Server Intellect who ever they are and what ever they do...too much mention of a company name implies that they are not good after all and are very desperate.
#13 pass4sure download
Posted By: pass4sure download | 4.25.2010 at 12:33 PM
Best package, good line up all AJAX enabled, never see this in my life.
#14 testking HP0-S21
Posted By: testking HP0-S21 | 5.03.2010 at 6:05 AM
I like your blog very much.
#15 testking 000-025
Posted By: testking 000-025 | 5.03.2010 at 6:05 AM
Your blog is great.
#16 testking 000-200
Posted By: testking 000-200 | 5.03.2010 at 6:05 AM
Thanks for sharing.
#17 electric fence charger
Posted By: electric fence charger | 5.03.2010 at 7:02 AM
nice article. help me but i want to know the proper steps of making vs 2.0 website AJAX enabled
#18 wholesale laptop adapter
Posted By: wholesale laptop adapter | 5.21.2010 at 1:53 AM
ill explain how you can easily create an AJAX enabled web site within Visual Studio 2005 utilizing C# and how to utilize the AJAX framework to add a simple control from the list of controls available in the AJAX Control Toolkit
#19 vibram five fingers
Posted By: vibram five fingers | 6.05.2010 at 9:38 AM
That great!Great article!useful That what i'm looking for!
#20 nike air max
Posted By: nike air max | 6.05.2010 at 9:39 AM
This article give me a great help!thank you very much!
#21 cheap mbt shoes
Posted By: cheap mbt shoes | 6.18.2010 at 9:03 PM
good post!!thank you
#22 asp net
Posted By: asp net | 6.19.2010 at 1:20 PM
I am following your blog regularly and got great information. I really like the tips you have given. Thanks a lot for sharing. Will be referring a lot of friends about this. Keep blogging
#23 grow taller
Posted By: grow taller | 6.23.2010 at 6:41 AM
It looks that you are highly expert blogger. Your post is an excellent example of why I keep coming back to read your excellent quality content that is forever updated. That was exactly what I needed to read today.
#24 links of london
Posted By: links of london | 7.07.2010 at 3:17 AM
Certain sizes should be noticed when purchasing Pandora jewelry. Generally speaking
#25 tiffany co
Posted By: tiffany co | 7.21.2010 at 2:32 AM
many people choose Tiffany & Co brand.Now For classic and quality genuine silver jewelry, we present you the hottest Tiffany silver jewelry .get more http://www.tiffanyonsale.com/
#26 tiffany jewelry
Posted By: tiffany jewelry | 7.21.2010 at 2:32 AM
many people choose Tiffany & Co brand.Now For classic and quality genuine silver jewelry, we present you the hottest Tiffany silver jewelry .get more http://www.tiffanyonsale.com/
#27 tiffany jewellery
Posted By: tiffany jewellery | 7.21.2010 at 2:32 AM
many people choose Tiffany & Co brand.Now For classic and quality genuine silver jewelry, we present you the hottest Tiffany silver jewelry .get more http://www.tiffanyonsale.com/
#28 tiffany ring
Posted By: tiffany ring | 7.26.2010 at 6:50 AM
Tiffany On Sale Offer a wide range of fashionable Tiffany & Co silver jewelry, including Necklaces, Pendants, Bracelets, Earrings, Rings and Accessories with fantastic discount.more http://www.tiffanyonsale.com/
#29 tiffany bracelet
Posted By: tiffany bracelet | 7.26.2010 at 6:50 AM
Tiffany On Sale Offer a wide range of fashionable Tiffany & Co silver jewelry, including Necklaces, Pendants, Bracelets, Earrings, Rings and Accessories with fantastic discount.more http://www.tiffanyonsale.com/
#30 tiffany necklace
Posted By: tiffany necklace | 7.26.2010 at 6:50 AM
Tiffany On Sale Offer a wide range of fashionable Tiffany & Co silver jewelry, including Necklaces, Pendants, Bracelets, Earrings, Rings and Accessories with fantastic discount.more http://www.tiffanyonsale.com/
#31 golf equipment wholesale
Posted By: golf equipment wholesale | 8.03.2010 at 1:31 AM
The uniqueness of each partner is attributed to the inclination of this accession of buying new golf clubs. A tactics fitting produces golfclubs that specifically suit the height, strength, abandonment characteristics and clubhead walk through of the golfer.
#32 Jewelry wholesale
Posted By: Jewelry wholesale | 8.03.2010 at 1:32 AM
The type of band shaft again helps in predicting whether you'll reach seemly leadership a response or you won't. There's a choice between a enliven suite knob again a graphite-made conglomerate stem.
#33 Mens Adidas Shoes
Posted By: Mens Adidas Shoes | 8.08.2010 at 9:54 PM
It clarifies a lot of things.
#34 Christian Louboutin Pumps
Posted By: Christian Louboutin Pumps | 8.08.2010 at 9:55 PM
really good read. keep posting like this!
#35 mbt shoes
Posted By: mbt shoes | 8.11.2010 at 2:09 AM
well ti's cnie/
#36 Christmas Gifts
Posted By: Christmas Gifts | 8.19.2010 at 5:04 AM
Thanks for this post! It was extremely informative and helpful! I just learned everything I need to know today.
#37 waist bag factory
Posted By: waist bag factory | 8.19.2010 at 10:36 PM
ework to add a simple control from the list of controls available in the AJAX Control Toolkit.
The AJAX control we will be working with in
#38 m
Posted By: m | 8.21.2010 at 8:16 AM
gbfg
#39 pandora jewelry
Posted By: pandora jewelry | 8.25.2010 at 6:45 AM
Generally I do not post on blogs, but I would like to say that this post really forced me to do so, Excellent post!
#40 tiffany jewelry
Posted By: tiffany jewelry | 8.26.2010 at 4:53 AM
Good
#41 Ugg
Posted By: Ugg | 8.26.2010 at 6:33 AM
Got any reason to say no to cheap UGG boots? UGG boots that prevailed for years will still warm your frozen toes with the featured sheepskin leather,get more http://www.uggbootuksale.com/
#42 louis vuitton handbags
Posted By: louis vuitton handbags | 8.28.2010 at 12:13 PM
www.rolexreplicascollection.com http://www.louis-vuitton-handbag.net/ http://www.traderainbow.com http://www.edhardyclothesshop.com