JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Using the DataGrid Class

A data grid control that displays the items from data source in a table. Here is the inheritance hierarchy of the DataGrid class:

Object
   Control
      WebControl
         BaseDataList
            DataGrid

You can find the notable public properties of DataGrid objects in Table 23.4 and their notable methods in Table 23.5. (This class has no non-inherited events.) Note that as with other Web server controls, I am not listing the notable properties, methods, and events this class inherits from the Control and WebControl classes-you can find them in Chapter 15, Tables 15.1 to 15.5.

Table 23.4: Noteworthy public properties of DataGrid objects.

Property

Means

AllowCustomPaging

Gets/sets if custom paging is enabled.

AllowPaging

Gets/sets if paging is enabled.

AllowSorting

Gets/sets if sorting is enabled.

AlternatingItemStyle

Gets the style properties for alternating items.

AutoGenerateColumns

Gets/sets if columns are automatically created for every field.

BackImageUrl

Gets/sets the URL of an image for the data grid's background.

Columns

Gets the columns of the data grid.

CurrentPageIndex

Gets/sets the index of the current page.

EditItemIndex

Gets/sets the index of an item to be edited.

EditItemStyle

Gets the style properties of edited items.

FooterStyle

Gets the footer style properties.

HeaderStyle

Gets the header style properties.

Items

Gets the items in the data grid.

ItemStyle

Gets the item style properties.

PageCount

Gets the number of pages in the data grid.

PagerStyle

Gets the paging section style properties.

PageSize

Gets/sets the number of items in a page.

SelectedIndex

Gets/sets the index of the selected item.

SelectedItem

Gets the currently selected item.

SelectedItemStyle

Gets the style of the currently selected item.

ShowFooter

Gets/sets if the footer should be displayed.

ShowHeader

Gets/sets if the header should be displayed.

VirtualItemCount

Gets/sets the number of items for custom paging.

Table 23.5: Noteworthy public methods of DataGrid objects.

Method

Means

CancelCommand

Occurs when Cancel is clicked.

DeleteCommand

Occurs when Delete is clicked.

EditCommand

Occurs when Edit is clicked.

ItemCommand

Occurs when any button is clicked.

ItemCreated

Occurs when an item is created.

ItemDataBound

Occurs when an item is data bound to the data grid.

PageIndexChanged

Occurs when a page selection element is clicked.

SortCommand

Occurs when a column is sorted.

UpdateCommand

Occurs when Update is clicked.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor