Summary of the New Controls in ASP.NET 2.0

Summary of the New Controls in ASP.NET 2.0

In addition to the switch to the unified control architecture, ASP.NET 2.0 provides many new controls. There are also enhancements to many of the existing controls, which we'll examine in detail in Chapter 11. This section summarizes all the controls that are completely new. We've divided them into six groups:

  1. Standard form- and page-based controls, such as the bullet list and FileUpload controls

  2. Rich controls, such as the DynamicImage control and the Wizard control

  3. Login and authentication controls, used in conjunction with the ASP.NET authentication and access control features

  4. Navigation controls, such as the tree view and site map controls, and counters

  5. Data access and display controls designed to display relational data, XML data, and data held in other formats

  6. Mobile device controls, such as the phone call and pagination controls

Standard Form- and Page-Based Controls

Several new controls are available for generating standard elements for use in a Web page, including some that generate elements for use in a <form> section.

  • The HtmlHead, HtmlTitle, and HtmlLink controls can be used to generate server-side equivalents of the HTML <head>, <title>, and <link> elements while allowing server-side programming of their content.

  • The HtmlInputPassword, HtmlInputReset, and HtmlInputSubmit controls make it easier to generate <input> elements that represent password boxes, Reset buttons, and Submit buttons.

  • The BulletedList control creates either a <ul> or <ol> bullet list. It exposes properties that allow developers to specify the bullet type and the start number for numeric lists. It inherits from ListControl, so its use is familiar—including the ability to populate it using server-side data binding.

  • The FileUpload control generates an <input type="file"> element, allowing users to upload files to the server. On postback, it exposes properties that can be used to access the uploaded file stream.

  • The HiddenField control generates an <input type="hidden"> element and exposes its value on postback.

We look at all these controls in more detail later in this chapter.

Rich Controls

ASP.NET 1.0 contained several rich controls, and these proved to be a big hit with developers. We define a rich control as one that generates multiple different elements, and often client-side code as well, so as to create whole sections of UI or to provide features not supported by ordinary single HTML (or other) elements. A good example is the Calendar control, which generates a whole month of clickable dates and has navigation built in to scroll to other months. In ASP.NET 2.0, some exciting new rich controls are included in the Framework.

  • The DynamicImage control automatically translates an image into the correct format for different devices. It can stream the bytes for an image from an external source via a Byte array, or use the Image Generation Service (described later in this chapter).

  • The ImageMap control makes it easier to define client-side image maps and react to events that they raise.

  • The MultiView and View controls provide the same kind of features seen in the Internet Explorer Web Controls pack that is available for ASP.NET 1.x. The new controls allow developers to create different blocks of UI and insert the appropriate one into the page at runtime.

  • The Wizard control, which makes it easier to build multipage wizards that have the same look and feel as those encountered in non-Web applications.

  • A range of Web Parts controls, which can be used to generate portal-style pages that can be customized by each visitor.

The Web Parts technology and the associated controls were covered in Chapter 8. We look at all the other controls listed above in more detail later in this chapter.

Login and Authentication Controls

ASP.NET introduced built-in authentication and access control features as part of the Framework. In ASP.NET 2.0, the way that you interact with the classes exposed by the Framework when creating secured pages or folders is much simpler. Instead of writing code, you can use the new login controls.

  • The Login control presents the user with the customary Username and Password text boxes.

  • The LoginName control displays the name of the currently authenticated user.

  • The LoginStatus control displays the authentication status for the current user, such as Log In when not authenticated or Log Out when authenticated.

  • The LoginView control provides two templates in which the UI for a section of the page is declared. The appropriate template content is displayed, depending on the authentication status of the current user.

  • The PasswordRecovery control displays a three-step wizard that guides a user through the process of providing the details required to have a forgotten password sent to him or her.

All these controls were covered in detail in Chapter 6.

Navigation Controls and Counters

One area where there is no real support for developers in ASP.NET 1.x is when building effective navigation systems for a Web site or application. In ASP.NET 2.0, several new controls make it easier to build menus and other types of site navigation UIs. The new controls are listed below.

  • The TreeView control generates a collapsible tree view in the browser.

  • The SiteMapDataSource control exposes hierarchical XML data in a suitable format for data binding to navigation controls such as the TreeView.

  • The SiteMapPath control displays the hierarchical path through the site's menu system to the current page and supports navigation between pages.

  • The Menu control can be used to generate a range of interactive or static menu systems.

All these controls were covered in detail in Chapter 5.

Data Access and Display Controls

One of the major changes in the way pages that use separate sources of data are created in ASP.NET 2.0 is the provision of data source controls. This concept was originally pioneered in Web Matrix, which contained a simple data source control that makes server-side data binding much easier to achieve.

Web Matrix also included a new type of grid control, designed to make it easier to display the data exposed by a data source control. Several data source controls are included in version 2.0 of ASP.NET.

  • The SqlDataSource control and AccessDataSource control provide read and update access to almost any type of relational database.

  • The ObjectDataSource control provides access to data exposed through a strongly typed data layer, allowing n-tier techniques to be used.

  • The XmlDataSource control exposes hierarchical formatted XML documents for data binding to controls that can display hierarchical data.

  • The DataSetDataSource control exposes nonhierarchical ("flat") XML documents for data binding to grid and list controls.

  • The GridView, DetailsView, and FormView controls can be data-bound to various data source controls and can display data in a range of ways. They automatically adapt their output to suit different types of browsers, mobile devices, or other user agents.

The data controls were covered in detail in Chapters 3 and 4.

Mobile Device Controls

Support for different types of client devices is now integrated into the Page framework, and all the controls from the System.Web.UI.WebControls namespace. However, some new controls are aimed primarily at particular types of devices, such as cellular phones.

  • The ContentPager control works as part of the underlying page architecture to divide pages into separate sections for small-screen and mobile devices.

  • The PhoneLink control can be used in phone-enabled devices to initiate a phone call to a specified number.

We look at these controls in more detail toward the end of this chapter.

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows