|
Customize Sites With Web Parts
Use ASP.NET 2.0's Web Parts to give your users the power to create the site they want.
by Peter Vogel
April 15, 2005
Technology Toolbox: VB.NET, C#, ASP.NET, ASP.NET 2.0
Your users probably understand their needs better than you do. So why not give them the power to customize your application's interface according to their needs? ASP.NET 2.0 includes a new feature that lets you do precisely that. Build your WebForm page using Web Parts, and your users can customize your Web application's user interface.
Imagine a user is visiting a Web site you built that sells books. As your user looks at the page, she realizes that she doesn't like your design for the book-search facility. Rather than complain to you, she clicks on a button labeled "Customize," clicks on the block displaying the detailed book information, and drags the block to the left-hand side of the page. She also notices that, after clicking on the Customize button, she has a choice of a "more detailed" version of book information. She closes the current book information block, then selects the detailed version.
Let's also assume this user is interested only in fantasy books and wants to search only for newly released books. She can further customize the page by setting the textbox that searches on genre to "Fantasy," and setting the drop-down list that controls the sort order to "Most recent first." She'll return to the same configuration every time she visits your site. It isn't your user interface anymore, but something better: the user interface your user wants.
Turning on support for this kind of customization in ASP.NET 2.0 is as simple as dragging a single control onto your page: WebPartManager. You can use this control to designate zones on your page where users can add, change, or remove controls. Users can even connect controls to each other, so they pass data between themselves. And all it takes to give your users this functionality is a few lines of code.
The Visual Studio 2005 Toolbox features a tab called WebParts, which includes a dozen Web Part infrastructure controls that make up the Web Part framework. In addition to WebPartManager, these framework controls include Zones, which define the sections of a page users can customize; Editors, which let users set properties on a control; Catalogs, which list controls that you can add to the page; and ConnectionsZone, which allows two Web Parts to send data to each other.
Back to top
|