Summary of the New Controls in ASP.NET 2.0

As well as the switch to a unified control architecture, there are other changes to the range of controls provided with version 2.0 of ASP.NET. There are changes to many of the existing controls, which we'll examine later in this chapter, plus a whole range of new controls. We don't have room in this book to fully detail every control, and it's possible that the interfaces may change as ASP.NET moves from the current Technology Preview to a release version. However, we will discuss and demonstrate the important features of each controlstarting with a summary of all the new controls.

This section summarizes all the controls that are either completely new or substantially updated. We've divided them into six groups:

  • Standard form- and page-based controls , such as the bullet list and HTML table controls

  • Rich controls , such as the DynamicImage control and the Wizard control

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

  • Site navigation controls and counters , such as the tree view and site map controls

  • Data controls designed to display relational data, XML data , and data held in other formats

  • Mobile device controls , such as the phone call and pagination controls

Standard Form- and Page-Based Controls

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

  • 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 familiarincluding 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.

  • The new Table control has a built-in "details view" mode that automatically kicks in when a page containing a table is viewed on a small-screen device such as a cellular phone. There are also new controls to create header rows and footer rows.

We look at these controls in more detail later in this chapter. For the Technology Preview release of ASP.NET this won't be the final story because more controls will be added during the beta phasebut these haven't been written, so we can't cover them yet!

Rich Controls

ASP.NET 1.x 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, there are a few new rich controls included in the Technology Preview of the Framework, and several others are planned for beta releases and the final release. The controls that are implemented now are listed below.

  • The DynamicImage control automatically translates an image into the correct format for different devices and can stream the bytes for an image from an external source via a Byte array.

  • The MultiView and View controls provide the same kind of features as 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.

The Wizard control was covered in Chapter 9. The other controls listed above will be covered 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.

The login 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 UI, as well as adding support for recording the number of times that users click on specific links or visit specific pages. The new or updated controls are listed below.

  • The AdRotator control now exposes properties, methods , and events that allow developers to record impressions and click-throughs, display pop-up ads, and provide better interactivity.

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

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

  • The navigation controls, such as Button , HyperLink , and so on, can be used to record page impressions and user actions.

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

The SiteMapPath and TreeView controls were covered in detail in Chapter 5. The other controls listed above will be covered later in this chapter.

Data 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. There are several data source controls included in the Technology Preview version of ASP.NET 2.0, with more on the way for the final release version, plus a great new "grid" control. The controls provided with the Technology Preview version are listed below.

  • The SqlDataSource control, AccessDataSource control, DbDataSource control, OdbcDataSource control, and OleDbDataSource control provide access to various relational databases.

  • The ObjectDataSource control provides access to strongly typed data layers , as well as object stores such as those exposed by the new version of SQL Server (code-named "Yukon").

  • The XmlDataSource control uses XML documents and exposes the content as a set of data rows.

  • The GridView control can display data in a range of ways, including a new built-in details view mode.

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 primarily aimed at particular types of devices, such as cellular phones.

  • The Pager 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.

The mobile device controls were covered in Chapter 10. You'll see that some features of the controls we describe in this chapter are also particularly useful when the client is a small-screen device such as a cellular phone.



A First Look at ASP. NET v. 2.0 2003
A First Look at ASP. NET v. 2.0 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net