Saturday, June 20, 2009

Introduction to Web Parts in ASP.NET 2.0


Webparts provide us with an easy way to customize our website on runtime. Aside from their availability in Sharepoint portal server, webparts were introduced in 2.0. I have tried to cover all the common aspects of webparts in this article, like using different types of webparts and using a custom database.


It would not be wrong to say that web parts are going to be the future of web based management systems. Web parts give us the option to drag and drop objects on a page, change titles, border style, and properties of objects at runtime. Before the introduction of web parts it used to be a hectic task because we had to write a lot of java script and to save the state of contents in a database.

There are two basic things in web parts:

  • Web part manager.
  • Web part zones.

Web Part Manager

Web part manager is a manager for web parts behind the scenes. We normally don't do a lot of things with the web part manager either in code or in design mode.

Web Part Zones

There are four kind of zones in web parts

  • Web Part Zone
  • Editor Zone
  • Catalog Zone
  • Connection Zone

Web Part Zone:

It's a basic unit of web parts. By placing different contents in a web part zone we can allow a user to drag and drop contents on a page.

To use different zones place a dropdownlist and add following items in it.

  1. Browse
  2. Display
  3. Edit
  4. Catalog
  5. Connect

Write down following code on onChangeIndex event of this dropdownlist.

See full detail:

No comments: