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 and data base backup file,  which can be used to recreate a data base used in this example on your side.

See also: 
How to save dashboards created in ASPxDashboardDesigner to a DataSet
MVCxDashboardDesigner - How to save dashboards to a data base

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


Added By: John (DevExpress Support) at: 7/5/2016 6:02:53 AM    >>Is there any chance at all we might see an MVC example in the near future.
Thank you for your suggestion. We will prepare this example in the future.

>>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.
Give me some additional time to research this behavior.

>>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.

I have created a separate ticket for this question on your behalf: ASPxDashboardDesigner - save dashboards to a data base implementation. Let's continue our discussion there.Added By: James Badenhorst 1 at: 7/5/2016 6:25:59 AM    John,
Many thanks for your response.
Is there any news on the missing database with the report definitions?
Best regards
James
Added By: John (DevExpress Support) at: 7/6/2016 6:15:34 AM    Hi James,
I have updated this example projects.Added By: James Badenhorst 1 at: 7/6/2016 6:36:32 AM    John,
Works straight out the box.
Once again Many Thanks
James
Added By: Gregory Lange 1 at: 10/13/2016 8:23:25 AM    So if i am understanding correctly we need to make the class that implements the IEditableDashboardStorage like your example that then points to the database which will load or save the xml data to an xml column? Added By: John (DevExpress Support) at: 10/13/2016 8:34:00 AM    Yes Gregory. You are correct.

Viewing all articles
Browse latest Browse all 7205

Trending Articles



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