System.Web.UI.WebControls Namespace
Serves as the abstract base class for the DataList and DataGrid controls and implements the selection semantics which are common to both controls.
Visibility |
Name |
Value Type |
Accessibility |
public |
Caption
|
String |
[ Get , Set ] |
public |
CaptionAlign
|
TableCaptionAlign |
[ Get , Set ] |
public |
CellPadding
|
Int32 |
[ Get , Set ] |
public |
CellSpacing
|
Int32 |
[ Get , Set ] |
public |
Controls
|
ControlCollection |
[ Get ] |
public |
DataKeyField
|
String |
[ Get , Set ] |
public |
DataKeys
|
DataKeyCollection |
[ Get ] |
public |
DataMember
|
String |
[ Get , Set ] |
public |
DataSource
|
Object |
[ Get , Set ] |
public |
DataSourceID
|
String |
[ Get , Set ] |
public |
GridLines
|
GridLines |
[ Get , Set ] |
public |
HorizontalAlign
|
HorizontalAlign |
[ Get , Set ] |
public |
SupportsDisabledAttribute
|
Boolean |
[ Get ] |
public |
UseAccessibleHeader
|
Boolean |
[ Get , Set ] |
|
The BaseDataList class provides the common functionality for all data listing controls, such as the DataList and DataGrid. A data listing control is used to display the records of a data source, such as a System.Data.DataView. Each data listing control can have a unique display style and capabilities. Because the BaseDataList class is abstract, an instance of this class is not created directly. Instead, data listing controls inherit the methods and properties common to all data listing controls from this class.
The appearance of a data listing control can be controlled by setting certain properties of this class. You can control the amount of spacing between the cells of a data listing control by setting the CellSpacing property. To control the amount of spacing between the contents of a cell and the cell's border, set the CellPadding property. The border between the individual cells of a data listing control can be displayed by setting the GridLines property. The horizontal alignment of the content in the cells of a data listing control is controlled by setting the HorizontalAlign property.
The BaseDataList class provides methods and properties that allow you to bind a data source to a data listing control. Use the DataSource property to specify the data source to bind to.
NOTE: The data source must be an object that implements the System.Collections.IEnumerable interface ( such as a DataView, an ArrayList, or a Hashtable ) to bind to a control derived from the BaseDataList class.
If the data source contains multiple sources of data, use the DataMember property to specify the specific source to bind to the control. For example, if you have a System.Data.DataSet with multiple tables, you must specify which table to bind to the control. After you have specified the data source, use the DataBind method to bind the data source to the control.
The BaseDataList class contains a DataKeys collection that stores the key field of each record ( displayed as a row ) in a data listing control. This allows you to store the key field with a data listing control without displaying it in the control. The key field is commonly used as part of an update query string to revise a specific record in the data source. The collection is filled with the values from the field specified by the DataKeyField property.
The BaseDataList class provides a SelectedIndexChanged event that is raised when the selected item in the control changes. This allows you to create a custom event handler that performs a specific set of instructions when the event is raised.
DataGrid DataList