Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Filtered in blank date field records


We bound an ultrawingrid to a datasource that includes a date field. The datasource is a SQL stored procedure. Some records don't have a date value (i.e. they are NULL) and no visible date value is displayed for these records on the grid – all is good.

However when we enter a date in the date column filter and select less than, then all dates less than this date are displayed (good) BUT so are all records that have a blank date field.

How can I fix this?


  • 12480
    Suggested Answer
    Offline posted


    I was able to accomplish this by adding a special additional filter condition whenever the user filtered the date column. I added a new condition that required the rows not be equal to DBNull.Value. This made it so that any type of date-based filtering would remove the null dates.

    The code could be refined to check against specific types of filter conditions -- for example, if you wanted the null dates to still appear when filtering something like "Not Equal to May 29th."

    Please add the following code to your application and let me know what you think:

    private void ultraGrid1_AfterRowFilterChanged(object sender, AfterRowFilterChangedEventArgs e)


    UltraGridColumn dateColumn = this.ultraGrid1.DisplayLayout.Bands[0].Columns[0];

    if(e.Column == dateColumn && e.NewColumnFilter.FilterConditions.Count > 0)


    this.ultraGrid1.DisplayLayout.Bands[0].ColumnFilters[dateColumn].FilterConditions.Add(FilterComparisionOperator.NotEquals, DBNull.Value);