1. Computing & Technology

Discuss in my forum

ASP.NET Web Parts

Making your website configurable.

By , About.com Guide

Updated September 18, 2010

The idea behind ASP.NET Web Parts is that people who visit your web page can personalize the page to fit their own requirements. If someone wants to include one type of content in the page, but not another, they can tailor the page to their own preferences. The system remembers this personalization so they will get the same page the next time they visit. And ... good news! ... Web Parts are included in the free Visual Web Developer Express. So you can get started using them without paying Microsoft!

Web Parts don't allow people to include any content, however. The whole thing has to be designed and programmed in advance. What they can do is select the content they want from choices that you have provided. Web Parts let people move things around too so things that they want at the top of the page will be there and other things can be moved further down, or eliminated entirely.

You might also use this capability to provide a website that can be "morphed" for everybody over time. For example, suppose you're using your website to host a training program for a specific group of people and you want the site to reflect the specific things that are being studied this week and not last week. You could do that by using different Web Parts for the different training topics and turning them on or off at a server level.

The customizable version of MSN.Com is a great example of the use of Web Parts. This highly sophisticated page lets readers pick from a wide variety of content.

--------
Click here to display the illustration.
--------

Web Parts depends on Ajax Javascript to work it's magic and since Javascript has good cross browser compatibility, Web Parts works well in other browsers as well. As recently as 2007, some features (such as drag and drop in FireFox) didn't work very well, but those problems seem to have been eliminated now.

This article will introduce Web Parts by showing how to add them to your page; and then I show you one of the "Microsoft Wowee Demo" tricks where you can use Web Parts and User Controls to add a customizable database display in just a few mouse clicks.

(Full Disclosure: Some of the content of this article is taken from the forthcoming book "Pro ASP.NET 4.0 in VB 2010" and is used by permission of the publisher, Apress. I'm a co-author.)

On the next page, we dive right into Web Parts and build a site using them.

©2012 About.com. All rights reserved.

A part of The New York Times Company.