XPDataView.LoadOrderedData(LoadDataMemberOrderItem[], SelectedData) Method
Loads data from the specified result set to the data view, mapping data view columns to result set columns.
Namespace: DevExpress.Xpo
Assembly: DevExpress.Xpo.v24.1.dll
NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.TreeMap, DevExpress.Xpo
NuGet Package: DevExpress.Xpo
Declaration
Parameters
Name | Type | Description |
---|---|---|
members | LoadDataMemberOrderItem[] | An array of LoadDataMemberOrderItem objects which provide mapping information. |
data | SelectedData | An SelectedData object which represents a result set providing data to be loaded into the data view. |
Remarks
Call the LoadOrderedData method to map data view columns to result set columns when loading data into the XPDataView when any of the following is true:
- The order of data view columns specified via the XPDataView.Properties collection does not match the order of columns in the result set. This may be the case when you use mapping information to populate the data view with columns via the XPDataView.PopulatePropertiesOrdered method.
- The result set contains columns that will not be displayed in the data view.
Otherwise, call the XPDataView.LoadData method.
Note
If the number of columns within the XPDataView.Properties collection and data result set do not match, the LoadOrderedData method throws an exception.
Example
The following code snippet demonstrates how to use column mapping information to populate the XPDataView with columns, and load data.
// The result set retrieves four columns.
DevExpress.Xpo.DB.SelectedData resultSet =
session1.ExecuteQuery("SELECT Oid, Age, Name, BigPicture FROM [Person]");
// The data view will display only two of them - Name and Age.
// We map these columns to corresponding result set columns,
// using their indexes in the result set.
LoadDataMemberOrderItem[] personsLoadOrder = new LoadDataMemberOrderItem[] {
new LoadDataMemberOrderItem(2, "Name"),
new LoadDataMemberOrderItem(1, "Age")
};
// The data view is populated with columns and loads its data
// using the specified mapping information.
xpDataView1.PopulatePropertiesOrdered(session1.GetClassInfo<Person>(), personsLoadOrder);
xpDataView1.LoadOrderedData(personsLoadOrder, resultSet);