How to: Apply Default Filtering to Master Filters in ASPxDashboardViewer
- 3 minutes to read
Important
This documentation applies to v16.2. Starting with v17.1, the ASPxDashboardViewer control is in maintenance mode. In v19.1, the new Web Dashboard Control replaces the old Web Dashboard Viewer. This means that the Web Dashboard Viewer will not be included in our installation packages. See our blog post for more information.
Refer to the following KB articles to learn how to migrate to ASPxDashboard / ASP.NET MVC Dashboard:
ASPxDashboardViewer -> ASPxDashboard
How to migrate from ASPxDashboardViewer to ASPxDashboard working in the ViewerOnly mode
MVCxDashboardViewer -> MVCxDashboard
How to migrate from DashboardViewerExtension to DashboardExtension working in the ViewerOnly mode
The following example shows how to apply default filtering to master filter items using API of ASPxDashboardViewer. In this example, default filtering is applied to the following dashboard items.
- The ASPxDashboardViewer.MasterFilterDefaultValues event is handled to apply filtering to Grid and Tree View.
- The ASPxDashboardViewer.RangeFilterDefaultValue event is used to select the specified date range in the Range Filter.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-apply-default-filtering-to-master-filters-in-aspxdashboardviewer-t329519.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Dashboard_MFDefaultValues.WebForm1" %>
<%@ Register Assembly="DevExpress.Dashboard.v16.2.Web, Version=16.2.1.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.DashboardWeb" TagPrefix="dx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxDashboardViewer ID="ASPxDashboardViewer1" runat="server"
DashboardSource="Dashboard_MFDefaultValues.Dashboard1" FullscreenMode="True"
onmasterfilterdefaultvalues="ASPxDashboardViewer1_MasterFilterDefaultValues"
onrangefilterdefaultvalue="ASPxDashboardViewer1_RangeFilterDefaultValue"
Height="100%" Width="100%" >
</dx:ASPxDashboardViewer>
</div>
</form>
</body>
</html>