|
3 | 3 | [](https://supportcenter.devexpress.com/ticket/details/T386418) |
4 | 4 | [](https://docs.devexpress.com/GeneralInformation/403183) |
5 | 5 | <!-- default badges end --> |
| 6 | +# Dashboard for Web Forms - How to Load and Save Dashboards from/to a Database |
6 | 7 |
|
| 8 | +This example shows how to create a custom dashboard storage that allows you to store dashboards in a database. |
| 9 | + |
| 10 | +<!-- default file list --> |
| 11 | +## Files to Look At |
| 12 | + |
| 13 | +* [DataBaseEditaleDashboardStorage.cs](./CS/DataBaseEditaleDashboardStorage.cs) (VB: [DataBaseEditaleDashboardStorage.vb](./VB/DataBaseEditaleDashboardStorage.vb)) |
| 14 | +* [Global.asax.cs](./CS/Global.asax.cs) (VB: [Global.asax.vb](./VB/Global.asax.vb)) |
| 15 | +<!-- default file list end --> |
| 16 | + |
| 17 | +## Example Overview |
| 18 | + |
| 19 | +The example uses the [System.Data.SqlClient](https://docs.microsoft.com/en-us/dotnet/api/system.data.sqlclient?redirectedfrom=MSDN&view=net-5.0) members to connect and operate an MS SQL server database. |
| 20 | + |
| 21 | +A custom dashboard storage should implement one of the following interfaces: [IDashboardStorage](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.IDashboardStorage) or [IEditableDashboardStorage](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.IEditableDashboardStorage). |
| 22 | + |
| 23 | +The following API used in the example: |
| 24 | + |
| 25 | +- [LoadDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.IDashboardStorage.LoadDashboard(System.String)) |
| 26 | + |
| 27 | + Returns a dashboard by its ID in the XDocument format, which describes an object model of the dashboard. |
| 28 | +- [GetAvailableDashboardsInfo](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.IDashboardStorage.GetAvailableDashboardsInfo) |
| 29 | + |
| 30 | + Returns a list of IDs and Captions of dashboards available in the data storage. |
| 31 | +- [SaveDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.IDashboardStorage.SaveDashboard(System.String-System.Xml.Linq.XDocument)) |
| 32 | + |
| 33 | + Updates the dashboard with new settings by its id. |
| 34 | +- [AddDashboard](https://docs.devexpress.com/Dashboard/DevExpress.DashboardWeb.IEditableDashboardStorage.AddDashboard(System.Xml.Linq.XDocument-System.String)) |
| 35 | + |
| 36 | + Takes a dashboard definition with its caption, saves it to the data storage, and returns the ID of a new saved dashboard. |
| 37 | + |
| 38 | +Additionally, this example contains an SQL file ([SavedDashboards.sql](./CS/SavedDashboards.sql)), which can be used to recreate a database used in this example on your side. Do no forget to update the connection string in the **Web.config** file to make it valid in your environment. |
7 | 39 |
|
8 | 40 |
|
9 | 41 | ## Documentation |
|
0 commit comments