JavaScript Editor jscript editor     Web designer 



Main Page

Web applications commonly access data sources for storage and retrieval of dynamic data. You can write code to access data using classes from the System.Data namespace (commonly referred to as ADO.NET) and from the System.Xml namespace. This approach was common in previous versions of ASP.NET.

However, ASP.NET also enables you to perform data binding declaratively. This requires no code at all for the most common data scenarios, including:

ASP.NET includes two types of server controls that participate in the declarative data binding model: data source controls and data-bound controls. These controls manage the underlying tasks required by the stateless Web model for displaying and updating data in ASP.NET Web pages. As a result, you are not required to understand details of the page request lifecycle just to perform data binding.

Data Source Controls

Data source controls are ASP.NET controls that manage the tasks of connecting to a data source and reading and writing data. Data source controls do not render any user interface, but instead act as an intermediary between a particular data store (such as a database, business object, or XML file) and other controls on the ASP.NET Web page. Data source controls enable rich capabilities for retrieving and modifying data, including querying, sorting, paging, filtering, updating, deleting, and inserting. ASP.NET includes the following data source controls:

Data source control Description

ObjectDataSource

Enables you to work with a business object or other class and create Web applications that rely on middle-tier objects to manage data.

For more information, see ObjectDataSource Web Server Control.

SqlDataSource

Enables you to work with ADO.NET managed data providers, which provide access to Microsoft SQL Server, OLE DB, ODBC, or Oracle databases.

For more information, see SqlDataSource Web Server Control.

AccessDataSource

Enables you to work with a Microsoft Access database.

For more information, see AccessDataSource Web Server Control.

XmlDataSource

Enables you to work with an XML file, which is especially useful for hierarchical ASP.NET server controls such as the TreeView or Menu control.

For more information, see XmlDataSource Web Server Control.

SiteMapDataSource

Used with ASP.NET site navigation. For more information, see ASP.NET Site Navigation Overview.

Data-source controls can also be extended to support additional data access storage providers.

For more information on data source controls, see Data Source Controls Overview.

Data-bound Controls

Data-bound controls render data as markup to the requesting browser. A data-bound control can bind to a data source control and automatically fetch data at the appropriate time in the page request lifecycle. Data-bound controls can take advantage of the capabilities provided by a data source control including sorting, paging, caching, filtering, updating, deleting, and inserting. A data-bound control connects to a data source control through its DataSourceID property.

ASP.NET includes the data-bound controls described in the following table.

List Controls

Renders data in a variety of lists format. List controls include the BulletedList, CheckBoxList, DropDownList, ListBox, and RadioButtonList controls.

AdRotator

Renders advertisements on a page as an image that users can click to go to a URL associated with the advertisement.

For more information, see AdRotator Web Server Control.

DataList

Renders data in a table. Each item is rendered using an item template that you define.

For more information see the DataList Web Server Control.

DetailsView

Displays one record at a time in a tabular layout and enables you to edit, delete, and insert records. You can also page through multiple records.

For more information see the DetailsView Web Server Control.

FormView

Similar to the DetailsView control, but enables you to define a free-form layout for each record. The FormView control is like a DataList control for a single record.

For more information, see FormView Web Server Control.

GridView

Displays data in a table and includes support for editing, updating, sorting, and paging data without requiring code.

NoteNote

The GridView control supersedes the ASP.NET DataGrid control available in previous versions of ASP.NET.

For more information, see GridView Web Server Control.

Menu

Renders data in a hierarchical dynamic menu that can include submenus.

For more information, see Menu Web Server Control.

Repeater

Renders data in a list. Each item is rendered using an item template that you define.

For more information, see Repeater Web Server Control.

TreeView

Renders data in a hierarchical tree of expandable nodes.

For more information, see TreeView Web Server Control.

NoteNote

The DataGrid control available in previous versions of ASP.NET has been superseded by the GridView control, which includes expanded capabilities for sorting, paging, and modifying data. Existing pages that use the DataGrid control will continue to function. As with other data controls, the DataGrid control has been enhanced to interact with data source controls.

For more information, see ASP.NET Data-Bound Web Server Controls Overview.

See Also



JavaScript Editor jscript editor     Web designer