Skip to main content

GridControl.DataSource Property

Gets or sets the grid control’s data source.

Namespace: DevExpress.XtraGrid

Assembly: DevExpress.XtraGrid.v22.1.dll


public virtual object DataSource { get; set; }

Property Value

Type Default Description


An object representing the grid control’s data source.


Refer to the Data Binding and Master-Detail Relationships topics for information on which objects can be assigned to the DataSource property.

After the DataSource property is set to null, the ColumnView.FocusedRowHandle of the GridControl.MainView is set to GridControl.InvalidRowHandle. After a new data source is assigned to the DataSource property, the ColumnView.FocusedRowHandle is set to 0, to refer to the first data record.

The code sample below illustrates how to bind the GridControl to XML data.

gridControl1.DataSource = xmlDataSet.Tables["product"];
See Also