-
Notifications
You must be signed in to change notification settings - Fork 0
/
SqlDashboard.aspx.cs
33 lines (27 loc) · 1.52 KB
/
SqlDashboard.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using DevExpress.DashboardCommon;
using DevExpress.DashboardWeb;
using DevExpress.DataAccess.Sql;
using System;
namespace WebFormsDashboardDataSources.Pages {
public partial class SqlDashboard : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
DashboardFileStorage dashboardFileStorage = new DashboardFileStorage("~/App_Data/Dashboards");
ASPxDashboardSql.SetDashboardStorage(dashboardFileStorage);
// Uncomment the next line to allow users to create new data sources based on predefined connection strings.
//ASPxDashboardSql.SetConnectionStringsProvider(new DevExpress.DataAccess.Web.ConfigFileConnectionStringsProvider());
// Create a data source storage.
DataSourceInMemoryStorage dataSourceStorage = new DataSourceInMemoryStorage();
// Register an SQL data source.
DashboardSqlDataSource sqlDataSource = new DashboardSqlDataSource("SQL Data Source", "NWindConnectionString");
SelectQuery query = SelectQueryFluentBuilder
.AddTable("SalesPerson")
.SelectAllColumnsFromTable()
.Build("Sales Person");
sqlDataSource.Queries.Add(query);
dataSourceStorage.RegisterDataSource("sqlDataSource", sqlDataSource.SaveToXml());
// Set the configured data source storage.
ASPxDashboardSql.SetDataSourceStorage(dataSourceStorage);
ASPxDashboardSql.InitialDashboardId = "dashboardSql";
}
}
}