ASP.NET 2.0 includes changes to Web server controls from previous versions as well as introducing numerous new controls and features. This topic discusses both the general changes to controls as well as new controls and changes to existing controls.
You can now use themes to define a consistent look and feel for pages and controls. A theme is a set of elements, including skins, cascading style sheets ( CSS ), and images, that can be applied to an individual control, a page, or a Web site. For more information, see ASP.NET Themes and Skins Overview.
Validation controls expose a ValidationGroup property that enables you to specify discrete sets of validation controls that are validated ( or not validated ) together. You can get references to all of the validation controls for a validation group by calling the GetValidators method.
The Page class now includes an overload to the Validate method that takes a parameter that identifies a validation group. You can call the overload that takes the validationGroup parameter to force validation for only that validation group, or the overload that takes no parameters to force validation for all validation controls on the page.
Additionally, the Page class's IsValid property now considers validation controls only in the current validation group. The current validation group is determined by the control that caused validation to occur. For example, if a button control is clicked and causes validation for the LoginForm validation group, then the IsValid property will return true if all validation controls whose ValidationGroup property is set to LoginForm are valid.
Validation controls also now have a SetFocusOnError property. If the property is true, when a validation error occurs, focus is set to the control identified by the ControlToValidate property.
The CustomValidator class now has a ValidateEmptyText property. If the ValidateEmptyText property is true, the CustomValidator object calls the client-side validation method identified by the ClientValidationFunction property and raises the ServerValidate event even when the value that is being validated is an empty string.
For more information, see Web Forms Validation.
ASP.NET has a new data binding model that is built on data source controls. Data source controls connect to and retrieve data from a variety of data sources including databases, business objects, and XML, and make the data available for other controls to bind to, without requiring code. They can also support modifying data. Data-bound controls now include a DataSourceID property that identifies the data source control to bind to. For more information, see Introduction to Data Source Controls.
Additionally, list controls such as the ListBox and DropDownList controls now expose an AppendDataBoundItems property; when this property is set to true, the control combines statically defined list items with items dynamically added by data binding.
Several controls, including the TreeView control, support client callbacks, which enable the control to communicate with the server without requiring a full postback.