ASP.NET Team Blog

This Blog


Mehul Harry is the DevExpress Web Program Manager. Follow him on twitter: @Mehulharry

Subscribe (RSS, Email)


ASP.NET Grid Tip: How To Check For Empty Values In Header Filter

Here’s a quick and useful tip for finding empty values when using the ASPxGridView’s header filter. For example, if you have a Date column:

ASPxGridView Header Filter

And you want to find all the Orders which have an ‘Empty’ ShippedDate value, then follow these 2 simple steps:

  1. Override the ASPxGridView’s HeaderFilterFillItems event
  2. Add the following 2 lines of code:


C# Version:

protected void ASPxGridView1_HeaderFilterFillItems(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewHeaderFilterEventArgs e)
  e.Values.Insert(1, new FilterValue("Empty", "", "[" + e.Column.FieldName + "] Is Null"));
  e.Values.Insert(2, new FilterValue("Not Empty", "", "[" + e.Column.FieldName + "] Is Not Null"));


VB.NET Version:

  Protected Sub ASPxGridView1_HeaderFilterFillItems(ByVal sender As Object, ByVal e As DevExpress.Web.ASPxGridView.ASPxGridViewHeaderFilterEventArgs) Handles ASPxGridView1.HeaderFilterFillItems
    e.Values.Insert(1, New FilterValue("Empty", "", "[" & e.Column.FieldName & "] Is Null"))
    e.Values.Insert(2, New FilterValue("Non Empty", "", "[" & e.Column.FieldName & "] Is Not Null"))
  End Sub

This code create 2 new filter values for ‘Empty’ and ‘Not Empty’ which check if the field value is null:

ASPxGridView Header Filter With Empty Filter Option

Custom Filter

By using this event, you can also create custom filters which:

  • Check if a certain field value is greater 50
  • Choose which columns to add the custom filters
  • And more…

How? Check out the FilterValue Constructor help topic.

Sample Project

Here’s the sample project which contains both C# and VB.NET versions of the code. Click here to download: []

Then drop me a line here and let me know what you think of this tip. Smile

Published Mar 17 2009, 03:08 PM by
Bookmark and Share



is this using v8.5 or v9.1??

March 17, 2009 7:15 PM

Mehul Harry (DevExpress)

I used version 9.1 in the demo but it should work with the 8.3 version as well.

March 17, 2009 7:43 PM


Works great except...

 When you select either one of the custom filters nothing is displayed in the filter row.  How can you display the text in the filter row to inform user that one of these filters has been set?

April 14, 2009 12:05 PM

About Mehul Harry (DevExpress)

Mehul Harry is an ASP.NET technical evangelist at Developer Express. You can reach him directly at You can also follow him on Twitter:

Chat is one of the many ways you can contact members of the DevExpress Team.
We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

If you need additional product information, write to us at or call us at +1 (818) 844-3383


DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, Delphi, HTML5 or iOS & Android development. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

Copyright © 1998-2018 Developer Express Inc.
All trademarks or registered trademarks are property of their respective owners