)
We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Embed Dashboard Viewer in the multi-tenant environment

Platform: Dashboard Platform |
Control: Dashboard SDK |
Published Date: December 22, 2017 |
Last Revised Date: May 7, 2019

Steps to embed Dashboard Viewer in the multi-tenant environment

  1. Create a dashboard using the Syncfusion Dashboard Designer and refer the below link, getting started with Dashboard Designer.

https://help.syncfusion.com/dashboard-platform/dashboard-designer/getting-started

 

  1. Save the Dashboard File (*SYDX) in your local machine.

 

  1. To embed the Dashboard in your application, use the Syncfusion Dashboard Platform SDK. To know about how to embed the dashboard, refer the following link

 

ASP.NET MVC Application

https://help.syncfusion.com/dashboard-platform/dashboard-sdk/getting-started/aspnet-mvc.

 

ASP.NET CORE Application

https://help.syncfusion.com/dashboard-platform/dashboard-sdk/getting-started/aspnetcore

 

  1. Use the filterParameters API to filter the dashboard based on the Company ID of the different tenant (In Multi-Tenant environment). So, when the user logged in, the respective data will appear for each user on the same dashboard. To know more about the filterParameters API, refer the following link

https://help.syncfusion.com/dashboard-platform/dashboard-sdk/how-to/apply-filter-using-filterparameters-api#passing-parameter-with-filterparameters-api.

 

  1. Find the code snippet to render the dashboard with filterParameters API

in the ASP.NET MVC application

<body>
@Html.EJ().DashboardViewer("dashboard").ServiceUrl(@ViewBag.ServiceUrl).DashboardPath(@ViewBag.DashboardPath).FilterParameters(@ViewBag.filterParameters)
 </body>

 

in the ASP.NET CORE application as below

 
      <ej-dashboardviewer id="dashboard" service-url="@ViewBag.ServiceURL" dashboard-path="@ViewBag.DashboardPath" filter-parameters="@ViewBag.filterParameters" />
 

 

To set the values for filterParameters dynamically for each user in the ViewBag, refer the below code snippet

        public ActionResult ViewDashboard(string dashboardName)
        {
            if (Session["UserName"] == null)
            {
               return Redirect("Login");
            }
             var userDb = UserDetails.GetUserNames();
            LoginDetails user = userDb.FirstOrDefault(u => u.UserName == Session["UserName"] && u.Password == Session["password"]);
            if (user != null)//Check if the login user is valid or not
                ViewBag.filterParameters = "Company Id ="+ Session["TenantId"]; //Tenant ID of the current user is get from session and passing to filter parameters variable.
            else
                ViewBag.filterParameters = "";
            return View();
        }

 

  1. Dashboard Viewer sample in the Multi-Tenant Environment can be downloaded in the below link,

ASP.NET MVC Sample:

http://www.syncfusion.com/downloads/support/directtrac/195207/ze/Multi_Tenant-1426271152

 

ASP.NET Core Sample:

http://www.syncfusion.com/downloads/support/directtrac/195207/ze/DashboardViewerAspNetCoreDemo_2017-1508359489

 

 

Note:

User Name

Password

TenantId

user1@company.com

user1@company.com

1001

user2@company.com

user2@company.com

1002

user3@company.com

user3@company.com

1003

User4@company.com

User4@company.com

1004

User5@company.com

User5@company.com

1005

  • Both the dashboard file path and dashboard service URL used in the provided sample are demo purpose.

 

 

ADD COMMENT
You must log in to leave a comment
Comments
shusil satyal
Feb 20, 2018

can i get the full code for the multi tanent for .net core ??

Reply
Prince Solomon Bala Subramani [Syncfusion]
Feb 21, 2018

Hi  shusil,

Find the code snippet to render the dashboard with filterParameters API in the ASP.NET Core application. 

<ej-dashboardviewer id="dashboard" service-url="@ViewBag.ServiceURL" dashboard-path="@ViewBag.DashboardPath" filter-parameters="@ViewBag.filterParameters">ej-dashboardviewer>

 

 Frame the values for filterParameters dynamically for each user in the ViewBag and find the sample in the below link

 http://www.syncfusion.com/downloads/support/directtrac/195207/ze/DashboardViewerAspNetCoreDemo_2017-1508359489

Regards,

Prince Solomon

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon