Hi David
Thanks for contacting Syncfusion Support.
You can change the Connection string of a dashboard using onApplyConnection Event API. Please refer the following link to pass the connection string in the event
Note : Refer the Newtonsoft.Json assembly in addition to other assembly (Syncfusion.Dashboard.Encryption.dll) in your application. You can download NewtonSoft.json from here
Since you are using the web data source, we have the below changes in the mentioned UG
- Please use the modified below code snippet in controller of your application to generate the connection string for the dashboard created using web data source, instead of the below mentioned in UG.
Modified Code Snippet:
{
ConnectionStringBuilder obj = new ConnectionStringBuilder();
DashboardCryptoProvider provider = new DashboardCryptoProvider(EncryptionType.AES);
ConnectionParameters connectionParameter = new ConnectionParameters
{
Url : "", // Pass the web datasource url
UserName: "",
Password: "",
};
ConnectionProviderType connectionType = ConnectionProviderType.WebDataConnector; // Connection type used in the dashboard
OdbcDbmsType odbcType = OdbcDbmsType.None; // ODBC DBMS type, if any
Connection connectionName = new Connection { DataSources = new List<DataSourceConnectionString>() };
connectionName.DataSources.Add(new DataSourceConnectionString
{
Name = "Northwind Traders Sales Analysis", // Nane of the Data Source while designing the Dashboard in the Dashboard Designer
ConnectionString = obj.GenerateConnectionString(connectionParameter, connectionType, odbcType)
});
ViewBag.EncryptedString = provider.DoEncryption(Converter.SerializeObject(connectionName)); // You can pass the encrypted String in the onApplyConnection event API to change the change connection String
} |
We will update the UG with the mentioned changes for changing connection string of the dashboard designed using web data source at the run time in our upcoming release.
Please let us know, if you have any queries.
Thanks,
Renuka N.