Sign up for our newsletter

Email Address:

We endorse and use:

We use Code Spaces for our SVN Repository
We use nopCommerce for our open source e-commerce solutions
We use Umbraco for our open source CMS solutions
We use SilverStripe for our open source CMS solutions
We use SourceForge for our open source project hosting
We use the 960.gs css grid for our projects

Valid CSS!

Valid HTML 4.01 Transitional

AJAX, frameworks and .NET

Posted by Ed on 25 August 2009 | 0 Comments

Tags: , , , , , ,

I remember the day, many years ago, when I discovered Ajax.

Until then, partial page updates had been a mix of self posting pages and heavy javascript. It was either something that switched things on and off then by re-processing the whole page, then presenting it to the visitor or showing/hiding some divs that had been pre-populated already, meaning the partial update was quick, but the actual first page load was a real time-waster.

Well, I doubt I need to sell the great benefits of Ajax driven content, but for those of you who aren't sure, it allows web sites or pages to be created, with areas (normally <div>s) that add almost no additional time to load the markup, that can be updated through a client-side script, without processing the whole page again on the server. Cool or what?

This means you can add galleries, tabbing, menus, dialog boxes, messages, extra content, expandable panels, well, just about anything you need to communicate with the web site visitor, without redrawing the whole page, saving time and improving the user experience.

Ajax, which stands for Asynchronous Javascript and XML isn't really that 'new'. It's actually an evolution of DHTML (Dynamic HTML) which uses javascript, css and html to create dynamic client-side scripts to add animation, content changes and interactive content to web pages.

Ajax uses javascript, css, the DOM (Document Object Model) and the XMLHttpRequest object.

Put these 4 things together and you have the means to target any element within a web page, change any attributes that may be available to it through the DOM, match css elements to objects in the DOM, retrieve and process data in XML format that may be manipulated and displayed any or all of these elements and pieces of data dynamically. Yep, really cool.

So, now you know what Ajax is, getting web site Ajax enabled is pretty easy. You can either write some javascript yourself that does some pretty cool things or you can check out the many Ajax frameworks that are available. The advantage of using an established framework is that they are generally quite mature, are well maintained and will do 90% of even the most arduous tasks that you will need Ajax to perform, right out of the box.

You can see list of the most commonly available Ajax frameworks at http://en.wikipedia.org/wiki/List_of_Ajax_frameworks.

Most pre-written Ajax web site additions, such as galleries and effects libraries are based on prototype, jquery, scriptaculous or moo tools.

To start using Ajax in your web site is easy. Download the framework, add a reference to your chosen Ajax framework in your web page, like:

<script src="js/prototype.js" type="text/javascript"></script>

...then start calling things from your markup or your own processing script.

Note that IE won't allow you to run Ajax scripts rom the file system. They need to be run from a web server. IIS or Apache on localhost is fine. You'll might also run into some problems in IE if you don't use the correct DTD. use:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

And it should solve any issues with functions not doing anything.

Ok, so how does this relate to ASP.NET?

Well, most web designers and web developers saw the value of Ajax as soon as they read about it. In the early days, it was pretty intense stuff, there being nothing 'off the shelf' like prototype or jquery to do most of the tedious work for us.

Once these frameworks started to appear, many designers and developers wanted to use Ajax. Many clients were demanding it. To see some really neat Ajax in action is to want it.

Integrating Ajax framewoks into flat HTML, ASP3 or PHP based sites was a breeze. Using them with ASP.NET was not so straightforward.

In the early days, .NET AJAX was quite pitiful. Probably a kneejerk reaction to falling behind the open source offerings. You can imagine Microsoft just panicking to get something out there. Whatever it was.

I think this early version of Ajax for .NET did more harm than good. Compared to other frameworks, it was lacking. A lot of people were ignoring it.

So, the option is to use an open source framework like jquery or others. Great, we can show and hide things and do lots of nice tricks in the UI. So how about getting data and forms from external pages, using Ajax? After constantly getting ViewState errors and considering what was involved to integrate external data into the page correctly, like me, you probably gave up.

But then in May 2009 we get a new .NET Ajax release from Microsoft. Now this really is a revelation. You can see the contents at http://www.asp.net/ajax/ajaxcontroltoolkit/samples/. We can now integrate many Ajax enable items into ASP.NET in minutes.

To get started with this release, there are many video tutorials at http://www.asp.net/learn/ajax-videos/. More than enough to get you started or give you an insight into what this control library can add to your web site.

I still love prototype, all the cool things you can do with it and all the cool things that use it. But now, I am really excited about what I can do with .NET Ajax too.

Thanks for reading...


Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments

Text size: Aa Bb Cc

Follow us on...

N-WebDesign news

Terms :: Privacy :: © N-Web Design 2012