How to: Apply Master Filtering in the ASP.NET MVC Dashboard

  • 4 minutes to read

The following example demonstrates how to apply master filtering in the ASP.NET MVC Dashboard on the client side.

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

View Example

Imports DevExpress.DashboardWeb
Imports DevExpress.DashboardWeb.Mvc
Imports System
Imports System.Web.Mvc
Imports System.Web.Routing

Namespace MvcDashboard_SetMasterFilter
    Public Class MvcApplication
        Inherits System.Web.HttpApplication

        Public Shared Sub RegisterRoutes(ByVal routes As RouteCollection)

            routes.MapRoute("Default", "{controller}/{action}/{id}",
                            New With {Key .controller = "Home", Key .action = "Index", Key .id = UrlParameter.Optional})
        End Sub

        Protected Sub Application_Start()
            ModelBinders.Binders.DefaultBinder = New DevExpress.Web.Mvc.DevExpressEditorsBinder()
            AddHandler DevExpress.Web.ASPxWebControl.CallbackError, AddressOf Application_Error

            DashboardConfigurator.Default.SetDashboardStorage(New DashboardFileStorage("~/App_Data/"))
        End Sub

        Protected Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
            Dim exception As Exception = System.Web.HttpContext.Current.Server.GetLastError()
        End Sub
    End Class
End Namespace