All docs
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

XPO Data Source in ASP.NET Web Forms

  • 3 minutes to read

This topic shows how to add the DashboardXpoDataSource to an in-memory data source storage, and make it available to users. This example uses XPO Business Model based on the SQLite database.

Create an XPO Model

In your application, add the SQLite database to the project. In this example, it is nwind.db from the C:\Users\Public\Documents\DevExpress Demos 21.2\Components\Data directory.

In Web.config, specify a connection string to this SQLite database:

    <add name="NWindConnectionStringSQLite" connectionString="XpoProvider=SQLite;Data Source=|DataDirectory|\nwind.db" />

Create an XPO model based on the SQLite nwind.db database:

using DevExpress.Xpo;

namespace WebFormsDashboardDataSources {
    [Persistent("Categories"), DeferredDeletion(false)]
    public class Category: XPCustomObject {
        int categoryId;
        string categoryName;
        string description;
        public int CategoryID {
            get { return categoryId; }
            set { SetPropertyValue<int>("CategoryID", ref categoryId, value); }
        public string CategoryName {
            get { return categoryName; }
            set { SetPropertyValue<string>("CategoryName", ref categoryName, value); }
        public string Description {
            get { return description; }
            set { SetPropertyValue<string>("Description", ref description, value); }

Register an XPO Data Source

For example, your ASPX page contains the ASPxDashboard control which unique identifier is ASPxDashboardXpo:

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <div style="position: absolute; top: 0; bottom: 0; left: 0; right: 0">
            <dx:ASPxDashboard ID="ASPxDashboardXpo" runat="server" Width="100%" Height="100%">

You can define the XPO Data Source in the code-behind page that has the .aspx.cs or .aspx.vb extension depending on the language used:


A code-behind page is one of the variants where you can register the data sources. For example, you can also register them in the Global.asax.cs (Global.asax.vb) file.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using System;

namespace WebFormsDashboardDataSources.Pages {
    public partial class XpoDashboard : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
        // ...
            // Create a data source storage.
            DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();

            // Register an XPO data source.
            DashboardXpoDataSource xpoDataSource = new DashboardXpoDataSource("XPO Data Source");
            xpoDataSource.ConnectionStringName = "NWindConnectionStringSQLite";
            dataSourceStorage.RegisterDataSource("xpoDataSource", xpoDataSource.SaveToXml());

            // Set the configured data source storage.

            ASPxDashboardXpo.InitialDashboardId = "dashboardXpo";

The XPO Data Source is now available in the Web Dashboard:


Users can now bind dashboard items to data in the Web Dashboard’s UI.


The example shows how to make a set of data sources available for users in the Web Dashboard application.


View Example: How to Register Data Sources for ASP.NET Web Forms Dashboard Control