Setting the ASP.NET DataGrid Object dialog box options

Setting the ASP.NET DataGrid Object dialog box options

The DataGrid Object dialog box allows you to create and add a DataGrid object to an ASP.NET page.

To set the ASP.NET DataGrid Object dialog box:

Select the ID attribute (or label) of the DataGrid object.

This field is pre-populated with a value. You can change the value of the DataGrid; however, if you set the value of the field to that of an existing ID, you will be prompted to enter a new attribute value.

Select a DataSet to associate with the DataGrid.

This is the DataSet from which the DataGrid retrieves information. Dreamweaver fills the Grid Columns box with bound columns for all of the fields in the selected DataSet.

Remove the grid columns you dont want by selecting them in the Grid Columns box, and clicking the Minus (-) button.

You can edit the remaining grid columns by selecting a column in the Grid Columns box and setting its properties.

To change the DataGrid column type, click the Edit button and select a column type from the pop-up menu. A dialog box specific to the chosen column type will appear. Specify the content and formatting of the selected DataGrid column. The column types are listed in the following table:

DataGrid column type

Description

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 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 great 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.

Hyperlink

The Hyperlink Column displays information as hyperlinks. 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 fields, 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.

Repeat the previous step for each column you want to change.

To change the order of the columns in the DataGrid, select a column in the Grid Column box and click the up or down arrow to move the column left or right in the DataGrid.