Josh Lane on .NET RSS 2.0
 Thursday, January 11, 2007

I've been digging into the ASP.NET AJAX bits over the last few days... impressive stuff. As a developer who will have his static typing pried from his cold dead fingers, I *especially* appreciate the high "enabled functionality per lines of hand-written Javascript" ratio.  :-)

As an aside, I know it's very trendy to fawn all over Ruby and Javascript and the like, and I appreciate the movement toward dynamic language-like features in C# 2.0/3.0. But there's still TONS of useful work being done in crusty ol' statically typed languages. Let's not burn our "Learn C++ in 7 Minutes" books just yet.

Well, okay... maybe *those* books. But you see my point.

Anyway... back to AJAX. There are several ways to utilize the framework; the easiest is to drop an UpdatePanel and ScriptManager on your ASP.NET page, then add some child controls to the UpdatePanel. You then have the ability to update these child controls without refreshing the entire page. Note that you still end up doing a server POST (via written-for-you Javascript) to refresh the state of those controls, but that same Javascript gets the results of the postback and modifies the browser DOM to update the child controls of the UpdatePanel with their new state. The effect is that portions of your page are updated without doing a full browser refresh. Slick.

Where this really gets interesting is that you can combine UpdatePanel with some interesting client-side animations to indicate to the user that updates are occuring/have occured. Again, the amount of Javascript you have to write is, in many cases, none!

As a test, I wanted to use the MultiView control to display views (groups of controls) on a page. I wanted view switching to not require a page refresh (meaning, use UpdatePanel), and I also wanted some sort of neato (read: annoying and distracting) animation effect to occur each time the user switches views.

Here's what I came up with.  Interestingly, the "fade out" effect doesn't seem to work very well from the server (worked fine locally on the ASP.NET dev webserver). Source is here (you'll need this and this along with .NET 2.0 to run it): 

I imagine this is all very pedestrian to the AJAX long-timers, but I thought it was cool.

Thursday, January 11, 2007 4:36:16 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] -
AJAX | ASP.NET
Comments are closed.
Disclaimer

Don't blame my employer(s)... all of this is my fault.

© Copyright 2008 Josh Lane
Sign In
Locations of visitors to this page
DasBlog theme 'Business' created by Christoph De Baene (delarou)