Click here to Skip to main content
15,881,089 members
Articles / Web Development / ASP.NET

Basic Introduction to the Atlas UpdatePanel

Rate me:
Please Sign up or sign in to vote.
4.29/5 (13 votes)
10 Jul 2006CPOL2 min read 124.8K   30   34
This is a short tutorial on how to use the new "Atlas" UpdatePanel on your ASP.NET pages. It's simple, easy, and fun.

Introduction

Welcome! I have left adopting Atlas far too late as far as I'm concerned. It is so powerful and yet so easy. I didn't have a lot of time on my hands, so I thought getting to use this new technology would require a lot of my time and it didn't.

This article will give you a quick jumpstart into the amazing world of Atlas!!!

Let's Do It!

  1. Download Atlas, it's a 2.2 MB file so I doubt the boss will mind ;) Download here.
  2. Reference the Microsoft.Atlas DLL.
  3. Check to see if the Atlas Tools are added to your toolbox; if not, then right click your Toolbox and click Choose Items and just browse to the Atlas DLL.

Now comes the fun part.

Starting with Atlas

Drag and drop the ScriptManager tool onto your webpage. It'll create the following code:

XML
<atlas:ScriptManager runat="server" ID="">

Then, all you do is set the following:

  • Set EnablePartialRendering="true"
  • Give the UpdatePanel an ID

Your tag should look something like this now:

XML
<atlas:ScriptManager runat="server" EnablePartialRendering="true" ID="updateManager">

Great, step one complete. Remember, when using any Atlas control, you must have a ScriptManager on that page!

Creating an UpdatePanel

Now, drag and drop the UpdatePanel onto your form.

It'll create the following code:

XML
<atlas:UpdatePanel ID="" runat="server">
</atlas:UpdatePanel>

Again, give it an ID, then set its Mode to Conditional so your tag should look like this:

XML
<atlas:UpdatePanel ID="atlasPanel" runat="server" RenderMode="Inline" Mode="Conditional">
</atlas:UpdatePanel>

Now, the content for this panel must be entered as normal ASP.NET between ContentTemplate tags, so it should look like this now:

<atlas:UpdatePanel ID="atlasPanel" runat="server" RenderMode="Inline" Mode="Conditional">
  <ContentTemplate>
  </ContentTemplate>
</atlas:UpdatePanel>

So for example, you have two drop downs in the ContentTemplate. The first drop down being a set of countries and the second being a set of provinces or states.

XML
<atlas:UpdatePanel ID="atlasPanel" runat="server" RenderMode="Inline" Mode="Conditional">
    <ContentTemplate>
          <asp:DropDownList ID="drpCountry" runat="server" 
              DataTextField="DESCRIPTION" 
              DataValueField="PK" AutoPostBack="True">
          </asp:DropDownList>
          <asp:DropDownList ID="drpProvince" runat="server" 
              DataTextField="DESCRIPTION" 
              DataValueField="PK" AutoPostBack="True">
          </asp:DropDownList>
    </ContentTemplate>
</atlas:UpdatePanel>

So, when the user selects a different country, the province drop down reloads. Now usually, you'd have a postback to the server and the whole screen would reload. Not anymore. Simply select a different country; now, the provinces magically change without the postback.

Additional Events to Update Your Panel

The second part of the magic is, let's say, you have a button on the form somewhere that reloads both dropdowns, all you need to do is add a trigger to the UpdatePanel as follows:

XML
<atlas:UpdatePanel ID="atlasPanel" runat="server" RenderMode="Inline" Mode="Conditional">
  <ContentTemplate>
    <asp:DropDownList ID="drpCountry" runat="server" 
      DataTextField="DESCRIPTION" DataValueField="PK" AutoPostBack="True">
    </asp:DropDownList>
    <asp:DropDownList ID="drpProvince" runat="server" 
      DataTextField="DESCRIPTION" DataValueField="PK" AutoPostBack="True">
    </asp:DropDownList>
  </ContentTemplate>
  <Triggers>
    <atlas:ControlEventTrigger ControlID="btnReload" EventName="Click" />
  </Triggers>
</atlas:UpdatePanel>

and still no postback of the form!!!

Conclusion

Get started using Atlas people, it's fun, it's free, it's easy, and besides, such a performance boost is bound to get you some brownie points from the boss and the clients!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
South Africa South Africa
I have a year and half's experience in using the dotNet Framework. I enjoy trying to get my ASP.Net applications to perform as fast as possible due the fact that bandwidth shortages are very common here in South Africa.

I make extensive use of C#, ASP.Net, Javascripting, MSSQL and recently the beta's of ATLAS.

I also love playing XBOX360, guitar, PC games and I listen to mostly hard rock

Comments and Discussions

 
GeneralAtlas Toolkit Pin
mgaerber11-Jul-06 1:55
mgaerber11-Jul-06 1:55 
AnswerRe: Atlas Toolkit Pin
StevenMcD11-Jul-06 2:12
StevenMcD11-Jul-06 2:12 
GeneralRe: Atlas Toolkit Pin
Novacaine17-Jul-06 10:51
Novacaine17-Jul-06 10:51 
GeneralRe: Atlas Toolkit Pin
StevenMcD17-Jul-06 18:48
StevenMcD17-Jul-06 18:48 
GeneralRe: Atlas Toolkit Pin
Novacaine17-Jul-06 21:47
Novacaine17-Jul-06 21:47 
GeneralRe: Atlas Toolkit Pin
StevenMcD17-Jul-06 22:00
StevenMcD17-Jul-06 22:00 
QuestionRe: Atlas Toolkit Pin
lsugirljte3-Oct-06 5:59
lsugirljte3-Oct-06 5:59 
QuestionRe: Atlas Toolkit Pin
lsugirljte3-Oct-06 6:00
lsugirljte3-Oct-06 6:00 
AnswerRe: Atlas Toolkit Pin
lsugirljte4-Oct-06 6:12
lsugirljte4-Oct-06 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.