About the ASP.NET DataGrid and DataList controls

About the ASP.NET DataGrid and DataList controls

The ASP.NET DataGrid and DataList controls provide numerous options for displaying different data types (especially dynamic content from a database), and simplify the process of binding data sources to the controls. Dreamweaver supports both the DataGrid and DataList controls as server behaviors. The controls provide the following features:

DataGrid creates a multi-column, data-bound grid. This control allows you to define various types of columns, both to lay out the contents of the grid and to add specific functionality (edit button columns, hyperlink columns, and so on).

DataList displays items from a data source using templates. You can customize the appearance of the control by manipulating the templates that make up its different components.

Related topics

  • Adding an ASP.NET DataGrid to a page
  • Adding an ASP.NET DataList to your page
  • Modifying a DataGrid or DataList object

The ASP.NET DataGrid web control

The Dreamweaver DataGrid allows you to insert an ASP.NET DataGrid web control. The DataGrid control renders tables as multi-column grids, and can include different column types (heterogeneous columns) for defining the layout of cell contents. These include bound, button, and template columns, among others. In addition, the DataGrid supports interactive functionality such as column sorting, editing, and commands. The column types available in the DataGrid are shown in the following table:

DataGrid Column Type


Simple Data Field

Referred to as a "bound column" in ASP.NET, the Simple Data Field column lets you specify which data source field to display, and the data format the field will use with a .NET formatting expression.

Free Form

Referred to as a "template column" in ASP.NET, the Free Form column type lets you create combinations of HTML text and server controls to design a custom layout for a column. The controls within a free-form column can be data-bound. Free-form columns give you added flexibility in defining the layout and functionality of the grid contents, because you have complete control over how the data is displayed and what happens when users interact with rows in the grid.


The Hyperlink column displays information as hypertext links. A typical use is to display data (such as a customer number or product name) as a hyperlink that users can click to navigate to a separate page that provides details about that item.

Edit, Update, Cancel Buttons

Referred to as the Edit Command column in ASP.NET the Edit, Update, Cancel Button column lets users perform in-place editing of information in DataGrid rows. To do so, create an Edit, Update, Cancel column. At runtime, this column displays a button labeled Edit. When the user clicks the Edit button, the row data is displayed in editable controls such as text boxes, and the Edit button is replaced with Update and Cancel buttons.

Delete Button

The Delete Button lets a user delete a particular row by clicking a button.

Before using the DataGrid server behavior, you must define a DataSet (referred to as a recordset by other document types) for the DataGrid. For more information, see Understanding recordsets.

To learn more about the DataGrid control, and how it can be used to format dynamic data, visit the Microsoft website at http://msdn.microsoft.com/library/en-us/cpgenref/html/cpcondatagridwebservercontrol.asp.

Related topics

  • About the ASP.NET DataGrid and DataList controls
  • Adding an ASP.NET DataGrid to a page
  • Adding an ASP.NET DataList to your page
  • Modifying a DataGrid or DataList object

Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Developing Applications Rapidly
Building ColdFusion Applications Rapidly
Building ASP.NET Applications Rapidly
Building ASP and JSP Applications Rapidly