How to: Apply Master Filtering in ASPxDashboardViewer

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:

The following example demonstrates how to apply master filtering in ASPxDashboardViewer on the client side.

In this example, the ASPxClientDashboardViewer.SetMasterFilter method is used to select required rows in the Grid dashboard item while the ASPxClientDashboardViewer.SetRange method is called to select the required range in the Range Filter dashboard item. These methods are called in the ASPxClientButton.Click event handler of the ASPxButton1.

Note

Note that in OLAP mode, unique names are used instead of values.

function setMasterFilters() {
    var selectedValues = [['UK', 'Anne Dodsworth'], ['USA', 'Andrew Fuller']];
    var selectedRange = new ASPxClientDashboardRangeFilterSelection();
    selectedRange.Minimum = new Date(95, 1, 1);
    selectedRange.Maximum = new Date(96, 1, 1);

    setMasterFilter('gridDashboardItem1', selectedValues);
    setRange('rangeFilterDashboardItem1', selectedRange);
}

function clearMasterFilters() {
    clearMasterFilter('gridDashboardItem1');
    clearMasterFilter('rangeFilterDashboardItem1');
}

function setMasterFilter(itemName, selectedValues) {
    if (WebViewer.CanSetMasterFilter(itemName)) {
        WebViewer.SetMasterFilter(itemName, selectedValues);
    }
}

function setRange(itemName, selectedRange) {
    WebViewer.SetRange(itemName, selectedRange);
}

function clearMasterFilter(itemName) {
    if (WebViewer.CanClearMasterFilter(itemName)) {
        WebViewer.ClearMasterFilter(itemName);
    }
}
See Also