Completed
Last Updated: 22 Feb 2016 07:59 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 13 Nov 2015 12:49
Category: GridView
Type: Bug Report
3
FIX. RadGridView - ArgumentNullException when clicking the Excel-like filter button and a null value is available in the associated column
To reproduce:

public Form1()
{
    InitializeComponent(); 
    List<Item> items = new List<Item>();
    items.Add(new Item(1,"sample"));
    items.Add(new Item(2, null));
    items.Add(new Item(3, "sample2"));
    this.radGridView1.DataSource = items;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
    this.radGridView1.EnableFiltering = true;
    this.radGridView1.ShowFilteringRow = false;
    this.radGridView1.ShowHeaderCellButtons = true; 
}

public class Item
{
    public int Id { get; set; }

    public string Description { get; set; }

    public Item(int id, string description)
    {
        this.Id = id;
        this.Description = description;
    }
}

Workaround: If possible, instead of using null value, use empty string.
If not possible, you will have to employ 3 classes - MyFilterMenuTreeElement, MyFilterMenuTreeItem, MyListFilterPopup. The classes are provided in the attached project RadGridViewFiltering.zip. Once you add the classes to your project, all you have to do is to replace the default popup with the new one, in the FilterPopupRequired handler: 
		private void RadGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
        {
            if (e.FilterPopup is RadListFilterPopup)
            {
                e.FilterPopup = new MyListFilterPopup(e.Column);
            }
        }
		
The approach is also demonstrated in the attached project.
Attached Files:
3 comments
ADMIN
Stefan
Posted on: 10 Dec 2015 13:48
Hi Andreas,

I don't think this will be the fix, but I will send this information over to our developers and QA.

Thanks for the heads up.
Andreas Haeusler
Posted on: 09 Dec 2015 09:01
Hello Stefan,

thanks for the Workaround.
In case this is going to be the solution ending up in 2016 Q1: The filter still causes an exception if you have set the NullValue Property of the column (like "missing"). 

Regards,
Andreas
ADMIN
Stefan
Posted on: 18 Nov 2015 14:49
I just wanted to inform you that we have updated the item description with a workaround that should work until our next official release, when the issue will be officially resolved.

If you have any questions or concerns, you can use the comments below.