DevExpress-Examples / xaf-how-to-implement-dependent-views-in-a-dashboardview-filter-based-on-selection

How to filter a ListView displayed in a DashboardView based on another ListView's selection

Repository from Github https://github.comDevExpress-Examples/xaf-how-to-implement-dependent-views-in-a-dashboardview-filter-based-on-selectionRepository from Github https://github.comDevExpress-Examples/xaf-how-to-implement-dependent-views-in-a-dashboardview-filter-based-on-selection

XAF - How to implement dependent views in a DashboardView (filter based on selection)

This example illustrates how to filter a ListView displayed in a DashboardView based on another ListView's selection.

Scenario

When a DashboardView contains several list views, it is often required to make them dependent, e.g. display items of one ListView based on items or selection of another ListView.

chrome_WHVRxufQHv

Implementation Details

  1. Add a new ViewController to the YourSolutionName.Module project. For more information, refer to the following file: DashboardFilterController.cs.
  2. In the OnActivated method, retrieve DashboardViewItems via the FindItem method, and subscribe to the ControlCreated event of a DashboardViewItem whose ListView is used to filter data (hereinafter referred to as SourceView).
  3. In the ControlCreated event handler retrieve the SourceView via the DashboardViewItem.InnerView property and subscribe to its SelectionChanged event.
  4. In the SelectionChanged event handler, retrieve the View to be filtered (hereinafter referred to as TargetView) in the same way as the previous step.
  5. To get an object that is used for filtering, use the ListView.CurrentObject property.
  6. You can now add CriteriaOperator to the TargetView.CollectionSource.Criteria dictionary to filter the TargetView. In this example, we created an InOperator that uses SourceView objects to filter the AssignedTo column.

Files to Review

Documentation

ASP.NET WebForms Version

You can find the ASP.NET WebForms version of this example in the following branch: DevExpress-Examples/xaf-how-to-implement-dependent-views-in-a-dashboardview-filter-based-on-selection at 17.2.3+

Does this example address your development requirements/objectives?

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

About

How to filter a ListView displayed in a DashboardView based on another ListView's selection

License:Other


Languages

Language:C# 75.3%Language:HTML 24.7%