Skip to main content

ASPxDashboard.CustomFilterExpression Event

Allows you to include WHERE clauses into DashboardSqlDataSource queries.

Namespace: DevExpress.DashboardWeb

Assembly: DevExpress.Dashboard.v22.1.Web.WebForms.dll


public event CustomFilterExpressionWebEventHandler CustomFilterExpression

Event Data

The CustomFilterExpression event's data class is CustomFilterExpressionWebEventArgs. The following properties provide information specific to this event:

Property Description
DashboardId Gets the identifier of the current dashboard.
DataSourceComponentName Get the data source name, used in code to identify the data source’s object, for which the event has been raised. Inherited from CustomFilterExpressionEventArgs.
DataSourceConnectionName Inherited from CustomFilterExpressionEventArgs.
DataSourceName Gets the name of the data source for which the event has been raised. Inherited from CustomFilterExpressionEventArgs.
FilterExpression Gets or sets the filter expression that defines a WHERE clause included in the SQL query. Inherited from CustomFilterExpressionEventArgs.
QueryName Gets the name of the query for which the event was raised. Inherited from CustomFilterExpressionEventArgs.


The CustomFilterExpression event fires for each SelectQuery within DashboardSqlDataSource (the SqlDataSource.Queries property) and allows you to include a WHERE clause to a query at runtime using the e.FilterExpression event parameter. If filtering is already applied to the SQL query, e.FilterExpression returns a corresponding filter criteria.

For more information on how to create a filter criteria as a CriteriaOperator object, see Simplified Criteria Syntax.


The CustomFilterExpression event is not raised for custom SQL queries and stored procedures.


The following example shows how to handle the ASPxDashboard.CustomFilterExpression event to filter an SQL query at runtime. The e.QueryName event parameter is used to check the name of the query that should be filtered. The e.FilterExpression property specifies the required filter criteria.

View Example

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ASPxDashboard_CustomFilterExpression.WebForm1" %>
<!DOCTYPE html>

<head runat="server">
    <form id="form1" runat="server">
    <div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0;">
        <dx:ASPxDashboard ID="ASPxDashboard1" runat="server" Width="100%" Height="100%" 
using System;
using DevExpress.DashboardWeb;
using DevExpress.Data.Filtering;

namespace ASPxDashboard_CustomFilterExpression {
    public partial class WebForm1 : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            ASPxDashboard1.SetDashboardStorage(new DashboardFileStorage("~/App_Data/Dashboards"));

        protected void ASPxDashboard1_CustomFilterExpression(object sender, CustomFilterExpressionWebEventArgs e) {
            if (e.DataSourceConnectionName == "nwindConnection" && e.TableName == "Invoices") {
                e.FilterExpression = new BinaryOperator("CustomerID", "AROUT", BinaryOperatorType.Equal);
See Also