ASP.NET 2.0 Tutorials
Tutorials
ASP.NET 2.0ASP.NET 2.0 Free Tutorials : Using Web Parts and Controls in Web Pages
Table of Contents
ASP.NET 2.0 Free Tutorials : Using Web Parts and Controls in Web Pages
ASP.NET 2.0 Free Tutorials : Using Web Parts and Controls in Web Pages - Page 2ASP.NET 2.0 Free Tutorials : Using Web Parts and Controls in Web Pages
ASP.NET 2.0 Free Tutorials : Using Web Parts and Controls in Web Pages
In this tutorial you will learn how To create a page for containing Web Parts controls, To create content for the main zone and To create a user control.
In the preceding section we examined the concepts of Web Parts and the features of the controls that have been provided by ASP.NET 2.0 for rapidly creating web portals that are elegant and well laid out. We also theoretically appreciated the immense potential of allowing users to customize the content they wish to see. In this section we shall create a simple web page and use web parts and controls to demonstrate how all this can be done. click
To create a page for containing Web Parts controls
1. Close the default page and add a new page to the site named Start.aspx.
2. Switch to Design view.
3. Add a heading to the page with the text Web Parts Demonstration Page.
4. From the WebParts tab of the Toolbox, drag a WebPartManager control onto the page.
5. The WebPartManager control does not render any output, so it appears as a grey box on the designer surface.

6. Position the insertion point after the WebPartManager control, and press ENTER to add a line break.
7. In the Layout menu, click Insert Table, and create a new table that has one row and three columns. Click the Cell Properties button, select Top from the Vertical align drop-down list, click OK, and click OK again to create the table.



8. Drag a WebPartZone control into the left table column. Right-click the WebPartZone control, choose Properties, and set the following properties:

9. ID: SidebarZone
10. HeaderText: Sidebar
11. Drag a second WebPartZone control into the middle table column and set the following properties:
12. ID: MainZone
13. HeaderText: Main
14. Save the file.
Now the Web page has two distinct zones that can be controlled separately. The next step in the process is to create content. We shall create static content in this exercise to appreciate the concept.
The layout of the Web Parts zone is defined by the element ZoneTemplate as stated earlier in this tutorial. Inside this template any ASP.NET control can be added. For instance using a Label control static text can be added. When a regular server control such as a WebPartZone is added, ASP.NET views the control as a Web part control at runtime.
Next Page: ASP.NET 2.0 Free Tutorials : Using Web Parts and Controls in Web Pages - Page 2
