| By Jeevan Murkoth | Article Rating: |
|
| August 1, 2006 01:15 PM EDT | Reads: |
46,541 |
Now that we've seen what the ScriptManager is capable of, let's see how it handles the errors or exceptions that can occur during an asynchronous post back. By default, the ScriptManager traps exceptions and displays them as a message box. This may be not be the best way to convey that information to the user so the developer might want to replace it with one that's more user friendly. ScriptManager provides a way for a developer to do some error handling by defining an OnPageError event handler and assigning a custom error message .The error message can be displayed as an overlay over the page by defining an ErrorTemplate. At a minimum, this error template should contain a span or div element with the pre-set id errorMessageLabel and a button used to dismiss the error message. Before we round up our discussion about the ScriptManager, there's one more control, the ScriptManagerProxy that's a close relative. It's used in case the page already has an instance of the ScriptManager control and one of the controls needs to add a script or a service reference. It can also be used in a scenario where the Master page has a ScriptManager control already defined and the content page needs to add scripts or services.
UpdatePanel
After the script manager, the
UpdatePanel is the next most important Atlas server control. It lets
the developer divide the page into different sections and lets each
section be updated independently without refreshing the entire page.
This functionality translates straightaway into better user
interactions; partial refreshes are less disruptive than regular full
page refreshes. In reality, the UpdatePanel generates a post back
similar to the regular post back and in fact most of the page events
are triggered.
The Page.IsPostback even returns a true value for an update panel post back. Where the UpdatePanel post back differs from a normal post back in the page lifecycle is in the render event. In the case of an UpdatePanel post back, only those regions defined by the UpdatePanel are rendered and sent back to the client.
On the client side, the child controls of the UpdatePanel are replaced with the new content. This is known as partial rendering. For an UpdatePanel to work in partial rendering mode, it requires a ScriptManager with the EnablePartialRendering attribute set to true.
<atlas:UpdatePanel runat="server" ID="UpdatePanel2" Mode="Always">
<ContentTemplate>
<asp:label runat="server" Text="Keep changing me!" ID="Label1" />
</ContentTemplate>
</atlas:UpdatePanel>
Now that we're familiar with what partial rendering is, let's look at the UpdatePanel control in detail .The code snippet above shows the markup for an UpdatePanel. The UpdatePanel exposes a ContentTemplate. Any content that needs to be replaced by partial rendering needs to be inside the ContentTemplate. The UpdatePanel also has an attribute Mode that defines when the UpdatePanel content would be refreshed. Setting it to Always refreshes the content during each and every post back. If this isn't the case and the UpdatePanel is to be refreshed in response to certain events, it's possible by setting the value of the Mode attribute to conditional. After that, set the trigger that would cause the update. The UpdatePanel can accept a collection of triggers that would cause an update. These triggers are classified into two types:
<Triggers>
<atlas:ControlEventTrigger ControlID="btnTrigger" EventName="Click" />
</Triggers>
<Triggers>
<atlas:ControlValueTrigger ControlID="txtMessage" PropertyName="Text" />
</Triggers>
TimerControl
The timer control is used to set a
timer event and refresh the UpdatePanel or the page at set intervals.
The interval for the timer control is set in milliseconds. It's also
possible to define a handler for the OnTick event. The timer control is
a popular choice as a trigger for an UpdatePanel. The code snippet
below shows a timer control.
<atlas:TimerControl runat="server"
Interval="15000" ID="tickerTimer"
OnTick="tickerTimer_Tick" />
UpdateProgress
UpdateProgress is a nifty little
control that lets a developer display a templated message when an
asynchronous post back is in progress. It's used to cue the users that
something is happening in the background. The UpdateProgress control
defines a ProgressTemplate. Any content to be displayed when an update
is in progress has to be enclosed between the ProgressTemplate tags. In
the code snippet below, when an asynchronous update is in progress, a
div tag with an image and text is displayed and it is hidden as soon as
the update is complete.
<atlas:UpdateProgress ID="upe" runat="server">
<ProgressTemplate>
<div class="update">
<img src="../Images/icons/indicator.gif" alt=""/>
Updating....</div>
</ProgressTemplate>
</atlas:UpdateProgress>
Extenders and the Control Toolkit
Extenders are a
set of controls used to enhance or extend the behavior of existing
ASP.NET controls. They offer a variety of functionality and let
developers easily spruce up their Web sites with little or no effort.
The Atlas framework provides a set of extenders out-of-the-box and
support for creating new ones. Although a lot of the current crop of
extenders that provide client-side behavior have little to do with
AJAX, having these behaviors packaged as a control makes it easy for a
developer to use them and reuse the logic elsewhere.
The control toolkit is a collection of extenders. It provides the developer with a way to develop reusable Atlas controls and includes the full source code, documentation, and samples to help. According to Scott Guthrie, general manager of Microsoft's Developer Division, Microsoft plans to develop the toolkit as a collaborative Open Source project so both Microsoft and non-Microsoft developers can work on it. This model would definitely expand the control toolkit by many more extenders. Let's take a look at some of the extenders available in the April CTP version of Atlas.
Published August 1, 2006 Reads 46,541
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jeevan Murkoth
Jeevan Murkoth is a Microsoft Certified Solutions Developer (MCSD) in .NET (Early Achiever) and a Microsoft Certified Application Developer (MCAD) in .NET. He currently consults for Tennessee Valley Authority and lives in Chattanooga, TN. He has an MS in Management Information Systems from Texas Tech University.
![]() |
AJAXWorld News Desk 08/01/06 01:17:17 PM EDT | |||
Ever since the advent of the Internet, Web applications have lagged behind desktop applications in terms of interactivity and responsiveness. One of the biggest drawbacks in the conventional Web model has been the cycle of inactivity between the user request and the server response. Reducing this period of inactivity has been the point of focus for any developer who wants to improve the responsiveness of Web applications and raise the user experience to levels offered by desktop applications. |
||||
- Kindle 2 vs Nook
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Windows 7 – Microsoft’s First Step to the Cloud
- Cloud Expo and the End of Tech Recession
- Jill Tummler Singer, Deputy CIO of CIA, Keynotes at GovIT Expo
- Reality Check at the Cloud Computing Expo
- Visual Studio 2010 Is Cloud Friendly
- Fired SCO CEO Fires Back
- Kindle 2 vs Nook
- The Difference Between Web Hosting and Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- Wave on Ulitzer: Confessions of a Google Wave Fanboy
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- Cloud Computing Best Practices
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Infrastructure-as-a-Service Will Mature in 2010: Microsoft's David Chou
- Eval JavaScript in a Global Context
- Windows 7 – Microsoft’s First Step to the Cloud
- Google Maps and ASP.NET
- Crystal Reports XI & How It Has Changed
- Converting VB6 to VB.NET, Part I
- Creating Controls for.NET Compact Framework in Visual Studio 2005
- Where Are RIA Technologies Headed in 2008?
- How to Write High-Performance C# Code
- AJAX World RIA Conference & Expo Kicks Off in New York City
- Implementing Tab Navigation with ASP.NET 2.0
- i-Technology Photo Exclusive: Bill Gates & Steve Jobs In "Nerds"
- .NET Archives: Getting Reacquainted with the Father of C#
- i-Technology Viewpoint: "SOA Sucks"
- Programmatically Posting Data to ASP .NET Web Applications






























