The XpoDataSource component represents a collection of persistent objects and can be bound to a visual data-aware control (e.g. ASPxGridView, ASPxNewsControl, ASPxCloudControl, etc.) at design time.

After placing the XpoDataSource component onto the form, you must specify the persistent object type this data source will retrieve using the XpoDataSource.TypeName property.


Link the XpoDataSource to a session via the XpoDataSource.Session property, so that the data source can access the data store (database) to load and save persistent objects. For recommendations on how to create/destroy sessions, see Tutorial 6 - A Simple Guestbook (ASP.NET).

Use the XpoDataSource.Criteria property to specify how the collection is filtered during loading on the server side. The criteria expression should comply with Criteria Language Syntax.

XpoDataSource1.Criteria = "[Age] > ?";
XpoDataSource1.CriteriaParameters.Add("Age", TypeCode.Int32, "30");

For more information on how to retrieve specific data, see Connecting XPO to a Database Server (ASP.NET).

See Also