Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

ASPxDashboardDesigner - How to save dashboards to a data base

$
0
0

This example shows how to create a custom dashboard storage that allows storing dashboards in a data base. It uses the System.Data.SqlClient members to connect and operate an MS SQL server data base. 

A custom dashboard storage should implement one of the following interfaces: IDashboardStorage or IEditableDashboardStorage.

IDashboardStorage provides functionality to open and edit dashboards available in the storage. 
XDocument LoadDashboard(string dashboardID) - returns a dashboard by its ID in the XDocument format, which describes an object model of the dashboard.
IEnumerable<DashboardInfo> GetAvailableDashboardsInfo() - returns a list of IDs and Captions of dashboards available in the data storage.
void SaveDashboard(string dashboardID, XDocument dashboard) - updates the dashboard with new settings by its id.

IEditableDashboardStorage inherits the IDashboardStorage interface and contains one additional method that allows adding new dashboards to the storage.
string AddDashboard(XDocument dashboard, string dashboardName) - takes a dashboard definition with its caption, saves it to the data storage, and returns the ID of a new saved dashboard.

Additionally, this example contains an SQL query, which can be used to recreate a data base used in this example on your side. This data base backup file you will find in the attachment for this post. 

See also: How to save dashboards created in ASPxDashboardDesigner to a DataSet.

This example applies to the Web Dashboard Designer starting from v2016 vol 1. To learn how to achieve this goal in previous versions, refer to the OBSOLETE - ASPxDashboardDesigner - How to save dashboards to a data base example.

Question Comments

Added By: James Badenhorst 1 at: 7/4/2016 1:41:46 AM    Hi DevExpress,
Quote from above...
"Additionally, this example contains an SQL Server data base backup file and....."
Sorry, but there is no Database backup file that I can find. There is a script to create an empty database, but that is all.
Please would you be kind enough to rectify.
Regards
James
Added By: John (DevExpress Support) at: 7/4/2016 2:21:41 AM    Hi James,
I have attached this backup file to the initial post.Added By: James Badenhorst 1 at: 7/4/2016 8:32:39 AM    Many thanks John - Is there any chance at all we might see an MVC example in the near future.
Regards
James
Added By: James Badenhorst 1 at: 7/4/2016 8:50:40 AM    John,
Apologies - cant find it. The original script to build the table starts off as
"USE [T386418]
GO"
So I am assuming the backup file would be "T386418.bak". Please correct me if I am wrong.

POI - The example runner on this page does not seem to like or open the project in VS2010 (Our company default).
I have VS2015 installed, however the example runner always tries to open in VS2010 first, and fails with an incompatibility error. Have to close it down, navigate to folder and re-open with VS2015. Have not seen this behaviour before.
Regards
James
Added By: James Badenhorst 1 at: 7/4/2016 9:23:05 AM    John,
Having created my own SQL database called T386481, and created the Dashboards table for the dashboard storage, run the app and get the error in the bottom right of the screen "An error occured on an attempt to load the list of available data sources". Putting a breakpoint in the Application_Start method of the  Global.asax.cs file (where the Access97 connection string is set for the CustomerReports view), this is not being hit before the app errors.
Many Thanks
James



Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>