ASP.NET 2.0 (I) Enhancements to Existing Controls...

This article is the first in a series looking at ASP.NET 2.0. In this article we'll start with a consideration of the enhancements to existing controls that have been introduced...


By: Chris Sully Spacer Date: January 21, 2006Spacer

Introduction

This article is the first in a series looking at ASP.NET 2.0 though it follows on from my earlier overview articles on the subject. In this article we’ll start with a consideration of the enhancements to existing controls that have been introduced. Many controls have gained new properties to extend the functionality they offer, as well as increasing their consistency with the new controls in ASP.NET 2.0. For example the Table and DataGrid controls now automatically support the details view on small-screen and mobile devices. Many controls have also been extended to ensure they are more usable and accessible. We'll start with an overview of the categories of control improvement before looking at particular controls in more detail.

Note that the information presented is based on the Beta product so minor changes may have been introduced in the final product release.

Summary of Control Improvements

Accessibility

Several new properties are added to improve the support for producing accessible web sites:

Data Source Control Integration

DataSourceID: all existing controls that support data binding now expose this property, as well as the new controls that do so.

Forms and Postback

Changes have been made to the postback architecture to support new features such as setting and maintaining the input focus and specifying the default button for each page. The three changes affect only the HtmlForm control that implements a server side form.

Input Controls

List Controls

Mobile Device Support

Site and Page Counter Integration

These new features add 9 properties for counting page views and click throughs and are supported by the controls that provide links (AdRotators, the Button controls, HyperLink and ImageMap).

Themes Integration

To support the new theming features two properties are added: EnableTheming and SkinID to most controls descended from System.web.ui.controls.

Validation

Individual Controls

Let’s look in a little more detail at the specific controls that are new or that have changed significantly in 2.0.

AdRotator

Has been updated to include support for:

DataGrid

The DataGrid control in v2.0 use the same new device and control adapter architecture as the new GridView control to provide support for mobile devices. It automatically displays the contents in summary and details view, with links to select rows and to switch from on emdoe to another, with the SummaryViewColumn attribute being used to specify which column will be shown in summary view.

Literal

In 2.0 the Mode property has been added which allows you to control how the string assigned to the Text property is processed before being sent to the client. Why? So the page can tailor the output to suit different types of client device, e.g. if expecting WML rather than HTML. One of the three values of the LiteralMode enumeration which specifies valid values of the Mode property is Transform. When this is specified all markup not supported by the current client device is removed from output generated by the control.

Panel

The panel control has been enhanced in v2.0 to supporting presenting its content in a fixed size window with scroll bars as necessary. It has also been extended to work better with pagination through a ContentPager control, allowing output to be broken up into separate screens for client devices with smaller displays. This is specified via the AllowPaginate property. There is also support for FieldSets. Since HTML 4.0 <fieldsets> and <legend> elements have been part of the standard. These are designed to be used to group together controls in web pages. The text value provided for the panels GroupingText property is used for the <legend> element content and this and the value of the Panel control (the value of the text property) are displayed within the <fieldset> element when the control is rendered.

Table

ASP.NET 2.0 automatically adapts generated output to different client types, as we’ll see in further detail in subsequent articles. Support for this concept includes changes to the Table control to support 3 views of table data: a standard view for standard browsers and summary and details views for mobile phones (for example) which can be navigated between.

Summary

In this article we’ve looked at the changes to controls in ASP.NET 2.0 in overview. In the next article we’ll do the same for the brand new controls in ASP.NET 2.0.

References

ASP.NET v2.0 – the Beta Version
Homer et al.
Addison-Wesley