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.
Do click through to Chris’ full post for all the code and full explanation.