Skip to content

This example shows how to configure the ASP.NET Core Dashboard control so that it loads data in the multi-user environment.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/DashboardDifferentUserDataAspNetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BI Dashboard for ASP.NET Core - How to load different data based on the current user

This example shows how to configure the Dashboard control so that it loads data in the multi-user environment.

You can identify a user in the current session and handle the following events to select the underlying data source:

Files to Review

Example Structure

You can limit access to data based on the current user's ID. This ID is stored in the IHttpContextAccessor.HttpContext.Session.GetString("CurrentUser") value from session state. We use the standard IHttpContextAccessor with dependency injection to access the HTTP context in custom dashboard configurator.

When the application starts, you see the Index view with a ComboBox in which you can select a user. When you click the Sign in button, the ID of the selected user is passed to the CurrentUser session variable and you are redirected to the Dashboard view. In this view, the Web Dashboard control displays the lists of dashboards and every dashboard loads data available to the selected user. Below is a table that illustrates the user IDs and their associated datasources in this example:

Role Sql Json Excel Object Extract Entity Framework
Admin Categories Customers Bikes Sales Sales Categories
User Categories from different source with optional filter Customers from different source with optional filter Bikes from different source Sales from different source - Categories from different source
Guest - - - - - -

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)