Browse DevX
Sign up for e-mail newsletters from DevX


Creating Web Sites with ASP.NET Whidbey : Page 2

ASP.NET Whidbey adds a huge number of productivity features and enhancements. Although it's still early in the development process, Paul Sheriff and Ken Getz dig in and start playing with some of the new features, passing along what they've found.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

The ASP.NET Internet Site Template
Figure 2: A Master Page allows you to create a common look and feel and navigation for your complete site in one location. Each page uses this master page.
The ASP.NET Internet Site template makes a great starting place for an Internet site with public pages, and possibly a secure area for members. This template provides a complete site, with menus, login pages, secure folders, and a master page that you can modify to suit your own needs. (More on master pages later, but these pages allow you to create a "base page" into which you can insert your own content. This allows your site to have a consistent look and feel with very little effort.) This site also supplies pages for articles, and a picture gallery for members. If you've used the ASP.NET Community Starter Kit, you've got the basic idea. Figure 2 shows the default page built for you when you use the ASP.NET Internet Site template. This page shows off many of the new features of ASP.NET Whidbey. Most important, this page uses the new Master Page feature to create the basic look that's shared across all the pages within the site, and provides the content on the left and top portions of the page. The master page allows you to create a common look and feel for each page, but allows each page to have its own distinct content area.

The master page created by the Internet Site template includes a LoginView control at the upper right of the page that shows three hyperlinks: login, register, and contact. Once you log in, these three hyperlinks change automatically to logout, profile, and contact. In other words, the LoginView control manages the links based on the authentication state of the logged in user, so you don't have to do the work.

Figure 3: You can personalize pages using Web Parts.
On the sample page, you'll also find a new SiteMapPath control that shows you how you got to your current location within the site. On the default page, the control just displays "Home", but if you click on the Articles hyperlink on the left of the screen, then choose Article 1 from the tree view, you will see this control's text change to display Home > Articles > Article 1.

The data-bound TreeView control used for navigation on the left side of this page gets its data from an XML file. This special XML file, named app.sitemap, contains the data for navigating your site. You associate the app.sitemap file with a SiteMapDataSource control, and this SiteMapDataSource then becomes the data source for this TreeView control. The ASP.NET Intranet Site Template
Selecting the ASP.NET Intranet Site template creates a site that acts as a corporate portal. In addition to all the other features supplied by this page, as shown in Figure 3, the Intranet Site template supports personalization?you can click the Personalize This Page link, and then click and drag Web Parts around the page as shown in Figure 4.

Figure 4: Personalization allows you to move Web Parts around on the page, store the locations, and retrieve the locations when you later browse to the same page.
The new locations are saved for you, and when you next view the same page, the parts display as you last saved them. (This feature requires Microsoft Internet Explorer 5.5 or later.) The master page in this template site contains a LoginName control in the upper right corner of the page (taking advantage of Windows authentication to log in users), and a DataList control that displays the site map data from the DataSetDataSource control on the left side of the page. (This brings up another new feature—you can bind a DataSetDataSource control to an XML file directly. In that way, this DataList control retrieves data from an XML file, bound to the DataSetDataSource control that creates a DataSet based on data in the XML file.)

To create a Web Part, you simply create a user control and then add the control into a WebPartZone control. The WebPartZone control acts as a container for your user control, making it editable, customizable and moveable within the confines of any of the Web Part zones on the page. You'll learn more about creating Web Parts later in this article.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date