Using Themes and Skins for Personalization with Visual Basic 2005 - Editing a Part (Page 7 of 7 )
Next, change the drop-down list to Edit mode. Nothing much happens, but click on the drop-down tag on one of the Web Part controls. A menu appears that now includes Edit, as shown in Figure 12-58.
Click Edit and the Edit Zone appears, allowing you to edit the current Web Part, as shown in Figure 12-59.
The Appearance editor lets you change the title and look of the Web Part, while the Layout lets you change, among other things, the zone where the Web Part will appear.

Figure 12-57. Dragging a Web Part

Figure 12-58. Edit mode
Adding Parts from a Catalog
You may want to provide a catalog of Web Parts that your users can add to the various zones. To do so, open WebPartsDemo.aspx and find Zone 4. Remove it from the cell so that the cell is empty. Next, drag a CatalogZone control into newly empty cell. Click on the zone and in the Properties window make sure the HeaderText property is set to Catalog Zone. Drag a DeclarativeCatalogPart control into the zone, as shown in Figure 12-60.
Click the smart tag on theDeclarativeCatalogPartand select Edit Templates. From the standard tab of the Toolbox drag on a Calendar and a File Upload control, as shown in Figure 12-61.

Figure 12-59. Editor Zone in action

Figure 12-60. Adding a DeclarativeCatalogPart control

Figure 12-61. Dragging controls into the Declarative Template
Before you run your program, switch to Source view and find the catalog zone you’ve added. Within the<WebPartsTemplate>element, add aTitleattribute to both theCalendarand theFile Uploadcontrols, as shown in Example 12-27. (Again, IntelliSense will not like this attribute, but be strong and do it anyway.)
Example 12-27. Catalog Zone
<asp:CatalogZone ID="CatalogZone1" runat="server">
<ZoneTemplate>
<asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" runat="server">
<WebPartsTemplate>
<asp:Calendar ID="Calendar1" runat="server"
title="Calendar" />
<asp:FileUpload ID="FileUpload1" runat="server" title="Upload Files" />
</WebPartsTemplate>
</asp:DeclarativeCatalogPart>
</ZoneTemplate>
</asp:CatalogZone>
Run the application. Drop down the display mode and notice that the Catalog mode has been added, as shown in Figure 12-62.

Figure 12-62. Catalog added to Display mode
When you select Catalog, the Catalog Zone is displayed. You may select one of the controls and decide which zone to place it in, as shown in Figure 12-63.

Figure 12-63. Adding a control from the catalog
Once you’ve picked your control and the zone to add it to, click Add and the control instantly appears in the designated zone.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
|
This article is excerpted from chapter 12 of the book Programming Visual Basic 2005, written by Jesse Liberty (O'Reilly, 2005; ISBN: 0596009496). Check it out today at your favorite bookstore. Buy this book now.
|
|