Server Intellect

DropShadow AJAX control in ASP.NET 2.0 and C#

Category: AJAX

DropShadow 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 will be the “DropShadow” control. We will also learn that the DropShadow control can easily be manipulated via its properties so it can have the look and feel of the controls that took painstakingly long to design when we had to drop our label controls on top of other colored label controls to get the shadow effect.

Server Intellect offers Windows Hosting Dedicated Servers at affordable prices. I'm very pleased!

In the previous article we learned the following about AJAX and what you can do with it?
“ASP.NET AJAX is a free framework for quickly creating efficient and interactive Web applications that work across all popular browsers.”

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 DropShadow 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 certain portions of this article may 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 a 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.

Try Server Intellect for Windows Server Hosting. Quality and Quantity!

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".

Fig. 1

1
[Click to see full-size]
  • 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 create your projects or as you drop AJAX controls onto your form.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 Panel that we will be using for the DropShadow effect. This is also the “TargetControlID” of the DropShadow control. Meaning that we are extending the Panel control with the DropShadow functionality.

Server Intellect assists companies of all sizes with their hosting needs by offering fully configured server solutions coupled with proactive server management services. Server Intellect specializes in providing complete internet-ready server solutions backed by their expert 24/365 proactive support team.

<asp:Panel ID="Panel1" runat="server" BackColor="#00C0C0" Height="254px" Width="242px" >

  • The next step is to add the controls and text to the panel, in our example we are going to simply drop another AJAX control called a SliderExtender [Slider Bar]. In order to use the SliderExtender we will need to first add a TextBox control so we can use that as the TargetControlID of the SliderExtender. What this means is that we will be extending the TextBox control with the SliderExtender as explained above, but before we can do that we will need to add the TextBox to our form.

<asp:TextBox ID="TextBox1" runat="server" Width="125px"></asp:TextBox>

  • The next step is to setup the SliderExtender to extend the TextBox we added in the previous step. We do that by selecting the SliderExtender control from the AJAX Controls tab in your toolbox and dropping it on the form. Then we will set the TargetControlID to “TextBox1”. You will not visually see the Slider until you run your application, setting the TargetControlID does not change the appearance of the TextBox in your development environment, only when you actually load the form will you be able to see the Slider.

Please Note:

We will not be adding any logic to this SliderBar control; we are just adding it for aesthetic purposes so we do not have an empty DropShadow panel. However, in our next article we will be working with this control and extending the functionality of this SliderBar and the DropShadow control.

<cc1:SliderExtender ID="SliderExtender1" runat="server" TargetControlID="TextBox1">

  • The next step is to set the remaining properties we will be using for this example. We do that by adding the following entries into the Markup.

<cc1:DropShadowExtender ID="DropShadowExtender1" runat="server"
Rounded="True"
TargetControlID="Panel1"
TrackPosition="True"
Width="8"
></cc1:DropShadowExtender>

If you're looking for a really good web host, try Server Intellect - we found the setup procedure and control panel, very easy to adapt to and their IT team is awesome!

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.

DropShadow Properties

  • Rounded="True"
    • Set to true to set rounded corners on the target and the shadow. Default is false.
  • TrackPosition="True"
    • Whether the drop shadow should track the position of the panel it is attached to. Use this if the panel is absolutely positioned or will otherwise move.
  • TargetControlID="TextBox1"
    • This is the control that you are extending with the DropShadow control.

What our example application will look like
We have now covered all of the pertinent points of using the DropShadow 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.

Fig. 2

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 DropShadow control and explained how we can now display a professional looking Panel for our application.

We used over 10 web hosting companies before we found Server Intellect. Their dedicated servers and add-ons were setup swiftly, in less than 24 hours. We were able to confirm our order over the phone. They respond to our inquiries within an hour. Server Intellect's customer support and assistance are the best we've ever experienced.

References

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



Download Project Source - Enter your Email to be emailed a link to download the Full Source Project used in this Tutorial!



100% SPAM FREE! We will never sell or rent your email address!

Leave a Comment

Comments on this Article

Post a Comment
Name:
Website:
Email:
Comments:

#1 ZK@Web Marketing Blog

Posted By: ZK@Web Marketing Blog | 6.29.2009 at 5:09 AM

Although AJAX is essentially a client-side technique, most of its real-world deployments call for server-side processing. Most commonly, the data manipulated by your web site will reside in some RDBMS on the server. To make AJAX really useful, you need an easy and robust way to deal with this server-side data. Fortunately, ASP.NET AJAX provides a sound infrastructure for doing just that. AJAX communication happens between your browser and the server over the Internet. Naturally, web services can play a significant role in data transport and overall communication between the client and the server. This article shows how ASP.NET AJAX can consume ASP.NET web services.

#2 Search Engine Optimization in Toronto

Posted By: Search Engine Optimization in Toronto | 1.06.2010 at 11:19 PM

I really like the information you have shared with all the users, I've already bookmark this article for all my future references. :)

#3 Mobile Phones

Posted By: Mobile Phones | 3.03.2010 at 3:49 AM

I found your website perfect for my needs. It contains wonderful and helpful posts. I have read most of them and got a lot from them. To me, you are doing the great work. Carry on this. work at home In the end, I would like to thank you for making such a nice website.

#4 India Calling Cards

Posted By: India Calling Cards | 3.03.2010 at 3:49 AM

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well.

#5 Phone Cards

Posted By: Phone Cards | 3.03.2010 at 3:50 AM

Easy option to get useful information as well as share good stuff with good ideas and concepts

#6 cool games

Posted By: cool games | 3.07.2010 at 3:43 AM

Gorgeous article!

#7 1Z0-053 exam

Posted By: 1Z0-053 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.

#8 Clayton College of Natural Health

Posted By: Clayton College of Natural Health | 3.28.2010 at 7:55 AM

Hi..it was  a gripping post hi......

#9 Biometric time clock

Posted By: Biometric time clock | 4.23.2010 at 2:25 PM

the way you have written and explained is absolutely outstanding. thanks for sharing.

#10 Biometric time clock

Posted By: Biometric time clock | 4.23.2010 at 2:26 PM

the way you have written and explained was outstanding. Keep it up.

#11 testking 642-845

Posted By: testking 642-845 | 4.29.2010 at 6:32 AM

I like your blog very much.

#12 testking 642-892

Posted By: testking 642-892 | 4.29.2010 at 6:33 AM

Thanks for sharing.

#13 testking 642-972

Posted By: testking 642-972 | 4.29.2010 at 6:33 AM

Your blog is great.

#14 5 binders

Posted By: 5 binders | 5.03.2010 at 10:35 AM

I was really not aware of this, couldn't imagine as well. thanks for sharing.

#15 plant relocation California

Posted By: plant relocation California | 5.15.2010 at 8:05 AM

the way you have described the matter is pretty interesting. thanks for sharing this.

#16 Giocare al casinò in rete

Posted By: Giocare al casinò in rete | 5.19.2010 at 1:19 AM

I found this is an informative and interesting post so i think so it is very useful and knowledgeable. I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well. In fact your creative writing ability has inspired me. Really the article is spreading its wings rapidly...

#17 wholesale laptop adapter

Posted By: wholesale laptop adapter | 5.21.2010 at 1:51 AM

xplain how you can easily create an AJAX enabled web site within Visual Studio 2005 utilizing C# and how to utilize the AJAX framewo

#18 air max 2009

Posted By: air max 2009 | 5.23.2010 at 5:00 AM

nike air max sale

#19 coach handbags

Posted By: coach handbags | 5.24.2010 at 3:21 AM

The Far East aristocrat becomes fashion new influence … “the Russian always to choose best goods - - Chanel in the best brand the handbag and the coat,

#20 vibram five fingers

Posted By: vibram five fingers | 6.05.2010 at 9:32 AM

That great!Great article!useful That what i'm looking for!

#21 nike air max

Posted By: nike air max | 6.05.2010 at 9:34 AM

This article give me a great help!thank you very much!

#22 michael jordan shoes

Posted By: michael jordan shoes | 6.18.2010 at 8:59 PM

good post!!thank you

#23 drop shadow

Posted By: drop shadow | 6.19.2010 at 1:21 PM

I am pretty much pleased with your good work.You put really very helpful information.

#24 grow taller 4 idiots

Posted By: grow taller 4 idiots | 6.23.2010 at 6:39 AM

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

#25 links of london

Posted By: links of london | 7.07.2010 at 3:18 AM

rings should be measured according to the thickness of finger; neither too tight

#26 Free website Hosting

Posted By: Free website Hosting | 7.16.2010 at 8:39 AM

I once tried creating a website which was AJAX enabled, within Visual Studio 2005, but somehow I made a mess of things and finally gave up.

#27 tiffany co

Posted By: tiffany co | 7.21.2010 at 2:38 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 jewelry

Posted By: tiffany jewelry | 7.21.2010 at 2:38 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/

#29 tiffany jewellery

Posted By: tiffany jewellery | 7.21.2010 at 2:38 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/