oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

What Are Web Parts?
Pages: 1, 2, 3, 4

Adding the User Control to Your Page: Drag and Drop

Return to Default.aspx in design mode, and make room between your Web Part Manager and your table of Web Part Zones. Drag the ascx file icon from Solution Explorer onto your page and <bang!> your control is registered and ready to use! (you can check the source code and see that the registration statement has been added for you).

Before running your program, delete a Web Part Zone from one of the cells and in its place drag in an Editor Zone from the Toolbox. Right-click on the smart tag and use the auto-format option to set the Professional format. Switch to Design view and find your Editor Zone, and drag in an Appearance Editor part:

  <asp:AppearanceEditorPart ID="AppearanceEditorPart1" runat="server" />

Run the application. If you switch from Browse to Design mode, the empty Web Part Zones become visible, and you can drag a control from one zone to another, as shown in Figure 5.

Figure 5
Figure 5. Dragging a control in Design mode

When you return to Browse mode, the control is where you've placed it.

You'll notice that if you choose Edit mode, nothing appears to happen. While in Edit mode, however, click the arrow next to the title of your control, and you now have a new option, Edit, as shown in Figure 6.

Figure 6
Figure 6. Edit menu choice

Click Edit and the Editor Zone you created appears and allows you to edit the control as shown in Figure 7.

Figure 7
Figure 7. Editing a zone

Pages: 1, 2, 3, 4

Next Pagearrow