Given that I’ve been focusing a lot on diet and exercise in my personal life, as well as AJAX and JavaScript in my professional life, this post by Chris Love struck me as pretty timely:

In my last post I waxed philosophically about the progression of ASP.NET. Today I want to start actually demonstrating how to take ASP.NET to the next level, at least in my opinion. The first thing I always add to a new web site is a contact form. Basically the form accepts a question or comment from a visitor and allows them to add their contact information to the request. The way I implement the form is to display a visual confirmation to the visitor, store the request in the site’s database, send an E-Mail to the visitor to confirm the request and send an E-Mail to the site administrator to alert them.  Traditionally this was done with a post-back to the server, which stored the information and sent the E-Mails. The confirmation was displayed in response to the post-back. Since AJAX has become popular this process has evolved.

First let’s examine implementing this form with an UpdatePanel and a MultiView control. I am not going to deal with the E-Mail or database activities because they do not really matter for this demonstration. The main thing is to see how to quickly add AJAX to the form. The UpdatePanel wraps a MultiView that is composed of two views, one for the form and one for the confirmation message.

Chris goes on to show examples of the thick (or fat, perhaps) way of doing things, with ASP.NET controls and an UpdatePanel control, then contrasts that with using standard HTML elements, in combination with JavaScript and a web service, to accomplish the same task. While I’m still a big fan of the productivity boost that comes with using ASP.NET web forms and controls, I have to admit that I’m also becoming increasingly fond of the lightweight approach. Thanks to ASP.NET MVC, I don’t have to give up ASP.NET just to go lightweight. I think my next project will be a lot thinner, even as I hope to be.

Do click through to Chris’ full post for all the code and full explanation.

Chris Love's Official ASP.NET Blog : The ASP.NET Diet Part 1 – Making a Thin Contact Form