Export (0) Print
Expand All

BaseDataList Class

Serves as the abstract base class for data listing controls, such as the DataList and DataGrid. This class provides the methods and properties common to all data listing controls.

For a list of all members of this type, see BaseDataList Members.

System.Object
   System.Web.UI.Control
      System.Web.UI.WebControls.WebControl
         System.Web.UI.WebControls.BaseDataList
            System.Web.UI.WebControls.DataGrid
            System.Web.UI.WebControls.DataList

[Visual Basic]
MustInherit Public Class BaseDataList
   Inherits WebControl
[C#]
public abstract class BaseDataList : WebControl
[C++]
public __gc __abstract class BaseDataList : public WebControl
[JScript]
public abstract class BaseDataList extends WebControl

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

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 System.Data.DataView, System.Collections.ArrayList, and System.Collections.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.

Requirements

Namespace: System.Web.UI.WebControls

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

BaseDataList Members | System.Web.UI.WebControls Namespace | DataGrid | DataList | CellSpacing | CellPadding | GridLines | HorizontalAlign | DataSource | DataMember | DataBind | DataKeys | DataKeyField | SelectedIndexChanged | System.Collections.IEnumerable | System.Data.DataView | System.Collections.ArrayList | System.Collections.Hashtable | System.Data.DataSet

Show:
© 2015 Microsoft