When Written: Nov 2006
I guess for anyone working with web application development using Microsoft technologies the recent announcement of the firming up of their ‘Atlas’ extensions for Visual Studio is going to be of interest. These very beta add ins to Visual Studio enabled the developer to start to do some development with Ajax technologies.
There were limitations because although you could drag and drop the components on to your application, wiring the objects up required a fair amount of hunting round to find the methods and properties of the components and to work out what code you needed to write. All this was not easy stuff and in the background there was always the warning ringing in the developer’s ears from Microsoft that all this could change in future versions. Sure enough things have changed and the forums have several postings from developers complaining that they have to re-write their application because Microsoft has ‘broken’ things.
To step uncharacteristically into Microsoft’s defence in this case, I would like to point out that anyone using beta or in this case pre-beta technologies for live application development must expect some grief as the technology evolves. None of us would want to be stuck with a technology that was full of bugs and hacks just because the developers were unable to fix them because users had already started using them. In this fast moving industry we often have to use beta software just to keep ahead of the game but one should always be aware of the problems that might arise and this is the case even more so in the case of pre-beta so it’s a case of ‘downloader beware’.
What Microsoft has done is to embrace the Ajax name within their Atlas extensions so now the server-side ‘Atlas’ technology is to be called ‘ ASP .Net 2.0 AJAX Extensions whilst the client-side components, which will interface to most server-side technologies like PHP or Cold Fusion as well as ASP .NET, are to be called the ‘Microsoft AJAX Library’ and finally the Atlas control Toolkit is now to be called the ASP.NET AJAX Control Toolkit. If this was just about marketing re-branding I wouldn’t even bother to have mentioned it but the technology has matured to a point that it is very usable and will produce excellent web application functionality with comparative ease. All this will be incorporated into the next release of Visual Studio which currently goes under the splendid name of ‘Orcas’ and is available in beta. However, you can also download the AJAX extensions into Visual Studio 2005 or Visual Web developer 2005; simply go to http://ajax.asp.net and follow the instructions.
Whilst we are on the subject of renaming you will note that I have been spelling AJAX with all capitals which is the way that Microsoft seem to prefer to write it, whilst in some of the forums people are actually being called ignorant because they do not write it the ‘correct’ way of ‘Ajax’. Even on the W3C site there are both ways of writing ‘ajax’ and whilst I would have thought that fully capitalised would have been correct as ‘AJAX’ is a mnemonic and stands for ‘Asynchronous Javascript and XML’. However according to most of the forums the ‘correct’ way of writing it should be ‘Ajax’ so now we know. Or do we?
So, what is so special about these extensions that seemingly can get you into trouble with your colleagues just by typing their name incorrectly? Simply, by adding a few lines of code you can define which areas of your web page will be redrawn based on other areas changing. For example if a user makes a selection from a list of items in a grid you can just redraw the area of the web page that displays the detailed information on the product. To do this you simply
First add a line to call the AJAX script manager:
<asp:ScriptManager ID=”ScriptManager1” EnablePartialRendering = “true” runat=”server” />
Then add an Atlas update panel with:
<asp:UpdatePanel ID=”mypanel” runat=”server”>
</asp:UpdatePanel>
In between this tag you put any objects that you wish to have rendered separately without the rest of the page being rendered, like perhaps a data grid. You then need to tell it what object change will trigger a refresh of this area. The code you need to add goes just before the </atlas tag and looks like:
<Triggers>
<asp:ControlValueTrigger ControlID=”MyDropDownList” PropertyName=”SelectedValue” />
</Triggers>
In this example a user changing the selected value in a dropdown list will cause the area defined by the updatepanel to be redrawn with the new data without any page refresh occurring, thus looking like a proper application.
This is a great step to making Ajax development easy and fast, something that it certainly has not been in the past.
Article by: Mark Newton
Published in: Mark Newton