Current filter:
                                You should refresh the page.
                                  • I have a xaf application which is used to analyse large amounts of data over 500,000 records.  My client wants to use the new dashboard module to visualise the data. I have created a series of stored procedures on the server to reduce the query times, which works fine. The issue arises when we attempt to save the dashboard. After saving the dashboard an error is thrown see attached image.

                                    a video of the error can be seen here: http://screencast-o-matic.com/watch/cbVq2tQHab

                                    Steps to reproduce

                                    1. Create a new dashboard and select Database as the source type
                                    2. Specify Connection credentials
                                    3. Select Stored Procedure or use Query builder
                                    4. Design Dashboard
                                    5. Save Dashboard (at this point the connection string looks to be rewritten and throws the error)

                                1 Solution

                                Creation Date Importance Sort by

                                Update:

                                Starting with v18.2 you are able to manage this behavior by using the SqlWizardSettings.DatabaseCredentialsSavingBehavior property as shown in the T742223: Dashboards - XAF doesn't allow storing credentials in Dashboard's XML content thread.

                                Hello Patrick,

                                We've intentionally disabled saving credentials for external datasources inside dashboards because a control in the Web Dashboards module (ASPxDashboard) doesn't support it due to security reasons (they are processed on the client side).
                                You need to manually provide credentials for such datasources.

                                Scenario:
                                In this example, it is demonstrated how to provide credentials to the Shipping Countries dashboard in our XCRM demo.

                                Steps to implement
                                1. In the YourSolution.Module  project, add a helper class that provides credentials:

                                [C#]
                                using System.Data.SqlClient; using DevExpress.DataAccess.ConnectionParameters; using DevExpress.ExpressApp; ... public static class SqlDashboardHelper { public static void SetupSqlParameters(MsSqlConnectionParameters connectionParameters) { connectionParameters.ServerName = "server"; connectionParameters.DatabaseName = "database"; connectionParameters.AuthorizationType = MsSqlAuthorizationType.SqlServer; connectionParameters.UserName = "user"; connectionParameters.Password = "password"; } }

                                2. To provide credentials for the ASP.NET WebForms app, add the following controller to  the YourSolution.Module.Web\Controllers  folder:

                                [C#]
                                using DevExpress.DashboardWeb; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Dashboards.Web; using DevExpress.Persistent.Base; using DevExpress.DataAccess.ConnectionParameters; ... public class WebDashboardCustomizeController : ViewController<DetailView> { public WebDashboardCustomizeController() { TargetObjectType = typeof(IDashboardData); } protected override void OnActivated() { base.OnActivated(); WebDashboardViewerViewItem dashboardViewerViewItem = View.FindItem("DashboardViewer") as WebDashboardViewerViewItem; if(dashboardViewerViewItem != null) { dashboardViewerViewItem.ControlCreated += DashboardViewerViewItem_ControlCreated; } } private void DashboardViewerViewItem_ControlCreated(object sender, EventArgs e) { WebDashboardViewerViewItem dashboardViewerViewItem = sender as WebDashboardViewerViewItem; dashboardViewerViewItem.DashboardDesigner.ConfigureDataConnection += DashboardDesigner_ConfigureDataConnection; //You can prevent setting direct Database connections using the following commented code in versions prior to 16.2.6. In the next versions, use the DashboardsModule.HideDirectDataSourceConnections property. //dashboardViewerViewItem.DashboardDesigner.ClientSideEvents.BeforeRender = "function onBeforeRender(s, e) { s.dashboardDesigner.unregisterExtension('dxdde-data-source-wizard'); }"; } private void DashboardDesigner_ConfigureDataConnection(object sender, ConfigureDataConnectionWebEventArgs e) { if(e.ConnectionName == "YOUR_CONNECTION_NAME") { e.ConnectionParameters = new MsSqlConnectionParameters(); SqlDashboardHelper.SetupSqlParameters((MsSqlConnectionParameters)e.ConnectionParameters); } } protected override void OnDeactivated() { WebDashboardViewerViewItem dashboardViewerViewItem = View.FindItem("DashboardViewer") as WebDashboardViewerViewItem; if(dashboardViewerViewItem != null) { dashboardViewerViewItem.ControlCreated -= DashboardViewerViewItem_ControlCreated; } base.OnDeactivated(); } }

                                Optionally, you can also prevent setting direct Database connections in the ASP.NET application using the following code in InitializeComponent method in YourSolution.Web\WebApplication.cs file:

                                [C#]
                                dashboardsModule.HideDirectDataSourceConnections = true;

                                Or you can change the value of this property with our Application Designer.

                                3. To provide credentials for the WinForms app, add the following controller to theYourSolution.Module.Win\Controllers  folder:

                                [C#]
                                using DevExpress.DashboardCommon; using DevExpress.DataAccess.ConnectionParameters; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Dashboards.Win; using DevExpress.Persistent.Base; ... public class WinDashboardCustomizeController : ViewController<DetailView> { WinShowDashboardDesignerController desingerController; WinDashboardViewerViewItem dashboardViewerViewItem; public WinDashboardCustomizeController() { TargetObjectType = typeof(IDashboardData); } protected override void OnActivated() { base.OnActivated(); dashboardViewerViewItem = View.FindItem("DashboardViewer") as WinDashboardViewerViewItem; if(dashboardViewerViewItem != null) { dashboardViewerViewItem.ControlCreated += DashboardViewerViewItem_ControlCreated; } desingerController = Frame.GetController<WinShowDashboardDesignerController>(); if(desingerController != null) { desingerController.DashboardDesignerManager.DashboardDesignerCreated += DashboardDesignerManager_DashboardDesignerCreated; } } protected override void OnDeactivated() { if(dashboardViewerViewItem != null) { dashboardViewerViewItem.ControlCreated -= DashboardViewerViewItem_ControlCreated; } if(desingerController != null) { desingerController.DashboardDesignerManager.DashboardDesignerCreated -= DashboardDesignerManager_DashboardDesignerCreated; } base.OnDeactivated(); } private void DashboardDesignerManager_DashboardDesignerCreated(object sender, DashboardDesignerShownEventArgs e) { e.DashboardDesigner.ConfigureDataConnection += DashboardDesigner_ConfigureDataConnection; } private void DashboardDesigner_ConfigureDataConnection(object sender, DashboardConfigureDataConnectionEventArgs e) { ConfigureDataConnection(e); } private void DashboardViewerViewItem_ControlCreated(object sender, EventArgs e) { WinDashboardViewerViewItem dashboardViewerViewItem = View.FindItem("DashboardViewer") as WinDashboardViewerViewItem; if(dashboardViewerViewItem != null) { dashboardViewerViewItem.Viewer.ConfigureDataConnection += Viewer_ConfigureDataConnection; } } private void Viewer_ConfigureDataConnection(object sender, DashboardConfigureDataConnectionEventArgs e) { ConfigureDataConnection(e); } private void ConfigureDataConnection(DashboardConfigureDataConnectionEventArgs e) { if(e.ConnectionName == "YOUR_CONNECTION_NAME") { e.ConnectionParameters = new MsSqlConnectionParameters(); SqlDashboardHelper.SetupSqlParameters((MsSqlConnectionParameters)e.ConnectionParameters); } } }

                                Also, if you don't plan to view these dashboards on the Web, you can enable saving credentials in a database in the following manner (you need to add this to YourSolution.Module.Win\Controllers  folder):

                                [C#]
                                using DevExpress.DashboardCommon; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Dashboards.Win; using DevExpress.Persistent.Base; ... public class WinDashboardController : ViewController { WinShowDashboardDesignerController winShowDashboardDesignerController; protected override void OnActivated() { base.OnActivated(); winShowDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if (winShowDashboardDesignerController != null) { winShowDashboardDesignerController.DashboardDesignerManager = new CustomDashboardDesignerManager(Application); } } public WinDashboardController() { TargetObjectType = typeof(IDashboardData); } } public class CustomDashboardDesignerManager : DashboardDesignerManager { protected override void ProcessDashboardBeforeSaving(Dashboard dashboard) { } public CustomDashboardDesignerManager(XafApplication application) : base(application) { } }

                                UPDATE:
                                Starting with v17.1, we hide the following page in the Data Source Wizard (you can learn more about it in a breaking change).

                                If you want to show it, replace CustomDashboardDesignerManager in the code above with the following:

                                [C#]
                                public class CustomDashboardDesignerManager : DashboardDesignerManager { protected override void OnDesignerShown(DashboardDesigner dashboardDesigner) { dashboardDesigner.DataSourceWizard.SqlWizardSettings.DatabaseCredentialsSavingBehavior = DevExpress.DataAccess.Wizard.SensitiveInfoSavingBehavior.Prompt; base.OnDesignerShown(dashboardDesigner); } protected override void ProcessDashboardBeforeSaving(Dashboard dashboard) { } public CustomDashboardDesignerManager(XafApplication application) : base(application) { } }

                                This functionality is demonstrated in our XCRM demo and you can find the full source code of this solution in the  C:\Users\Public\Documents\DevExpress Demos <Version>\Components\eXpressApp Framework\XCRM\CS  folder.

                                Thanks,
                                Alexander.

                                Show all comments
                                • Patrick Davey 01.20.2017

                                  Thanks Alexander.

                                  That fixed the issue.

                                • Alexander N (DevExpress) 01.20.2017

                                  You're welcome!

                                • Rodrigo Coelho 04.18.2017

                                  I have the same problem, but I didn't understand how to implement the solution. I'm begginer with DevExpress components in Visual Studio.
                                  Is there some sample application using this solution?

                                  Rodrigo.

                                • Alexander N (DevExpress) 04.19.2017

                                  Hello Rodrigo,

                                  I have updated our solution instructions with more information. I hope you find them helpful to implement this task in your project. If not, please attach your test project where you tried to implement this and specify exactly where you were stuck, so that we can provide further assistance.

                                • Rodrigo Coelho 04.19.2017

                                  I tried to apply your sample, but I have some problems using Firebird. I created a new issue to my doubt. Can you help me?

                                • Dennis (DevExpress Support) 04.19.2017

                                  @Rodrigo: Thanks for creating this ticket. We'll process it as soon as we can.

                                • Rodrigo Coelho 04.25.2017

                                  How to apply this solution for mobile?

                                • Anatol (DevExpress Support) 04.25.2017

                                  I've created a separate ticket on your behalf (T508061: How to pass connection parameters to a custom Dashboard data source in Mobile applications). It has been placed in our processing queue and will be answered shortly.

                                • Stavros Papadopoulos 05.25.2017

                                  Hi,

                                  where is the dialog of saving credentials in 17.1.3?

                                  The above sample can't be used for 17.1.3.

                                • Alexander N (DevExpress) 05.26.2017

                                  Hello Stavros.
                                  Thank you for your message. Could you please provide us with a sample project demonstrating your problem?
                                  I am looking forward to hearing from you.

                                  Thanks,
                                  Alexander.

                                • Stavros Papadopoulos 05.26.2017

                                  Hello Alexander,

                                  In version 16.2.x when selecting in XAF Dashboard module to make new Dashboard from Database datasource and insert credentials for SQL Server, after that we had a dialog to save them .

                                  In 17.1.3 this dialog doesn't exist. So we have again to put the credentials when opening the designed dashboard. The above code was inserted from us in 16.2.x and it worked well (public class WinDashboardController, saving con string to database)
                                  But now the problem continue to exist. Please see attached screenshot which dialog is missing in 17.1.3

                                  Hope this will help to see the problem.

                                  Thank you
                                  Stavros  

                                • Alexander N (DevExpress) 05.26.2017

                                  Stavros,

                                  We have a breaking change which explains the new behavior.

                                  You need to change CustomDashboardDesignerManager given in the example above as follows to enable this dialog:

                                  [C#]
                                  public class CustomDashboardDesignerManager : DashboardDesignerManager { protected override void OnDesignerShown(DashboardDesigner dashboardDesigner) { dashboardDesigner.DataSourceWizard.SqlWizardSettings.DatabaseCredentialsSavingBehavior = DevExpress.DataAccess.Wizard.SensitiveInfoSavingBehavior.Prompt; base.OnDesignerShown(dashboardDesigner); } protected override void ProcessDashboardBeforeSaving(Dashboard dashboard) { } public CustomDashboardDesignerManager(XafApplication application) : base(application) { } }

                                  Let me know if you have additional questions.

                                • Huseyin Dikmen 06.13.2017

                                  Dear DevExpress Support Team,

                                  I am making SQL dashboard with data source Wizard Dashboard 17.1.3 version. I applied above solutions but I still get same error which is that asking password when I view dashboard every time.

                                  I want you to offer me a general solution for all dashboard.
                                  I look forward to hear from you very soon.

                                  Thanks and regards. 

                                • Stavros Papadopoulos 06.13.2017

                                  Hi Huseyin,

                                  If you paste the last 2 code example in your products it will work. You can save the credentials of the database in the beginning. This worked on my side only for win forms:

                                  [C#]
                                  using DevExpress.DashboardCommon; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Dashboards.Win; using DevExpress.Persistent.Base; ... public class WinDashboardController : ViewController { WinShowDashboardDesignerController winShowDashboardDesignerController; protected override void OnActivated() { base.OnActivated(); winShowDashboardDesignerController = Frame.GetController<WinShowDashboardDesignerController>(); if (winShowDashboardDesignerController != null) { winShowDashboardDesignerController.DashboardDesignerManager = new CustomDashboardDesignerManager(Application); } } public WinDashboardController() { TargetObjectType = typeof(IDashboardData); } } public class CustomDashboardDesignerManager : DashboardDesignerManager { protected override void OnDesignerShown(DashboardDesigner dashboardDesigner) { dashboardDesigner.DataSourceWizard.SqlWizardSettings.DatabaseCredentialsSavingBehavior = DevExpress.DataAccess.Wizard.SensitiveInfoSavingBehavior.Prompt; base.OnDesignerShown(dashboardDesigner); } protected override void ProcessDashboardBeforeSaving(Dashboard dashboard) { } public CustomDashboardDesignerManager(XafApplication application) : base(application) { } }

                                  Regrads,
                                  Stavros

                                • Huseyin Dikmen 06.14.2017

                                  Hi Stavros

                                  Yes just thing. Thank you.

                                • JHorv 08.01.2017

                                  I want to point out a bug in the sample code provided, in the SetupSqlParameters method:

                                  [C#]
                                  using System.Data.SqlClient; using DevExpress.DataAccess.ConnectionParameters; using DevExpress.ExpressApp; ... public static class SqlDashboardHelper { public static void SetupSqlParameters(MsSqlConnectionParameters connectionParameters) { MsSqlConnectionParameters connectionParameters = new MsSqlConnectionParameters(); connectionParameters.ServerName = "server"; connectionParameters.DatabaseName = "database"; connectionParameters.AuthorizationType = MsSqlAuthorizationType.Windows; connectionParameters.AuthorizationType = MsSqlAuthorizationType.SqlServer; connectionParameters.UserName = "user"; connectionParameters.Password = "password"; } }

                                  This will cause a frustrating bug - the MsSqlConnectionParameters instance is locally overwritten, configured, and eventually discarded.  The MsSqlConnectionParameters instance the caller passed in is ignored.

                                  Also note the AuthorizationType property being set twice.

                                • Uriah (DevExpress Support) 08.02.2017

                                  Hello Jim,

                                  Thank you for your hint. I have updated the code snippet accordingly.

                                • ima_aa 02.28.2018

                                  would it be possible to save the password in a hashed form?

                                • Uriah (DevExpress Support) 02.28.2018

                                  Hello,

                                  I've created a separate ticket on your behalf, because we need to better understand our requirements: T611057: Clarification regarding the example provided in the T473885 ticket).  I will reply in that ticket soon.