Completed
Last Updated: 04 Jul 2016 13:07 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 28 Jun 2016 06:02
Category: GridView
Type: Bug Report
1
FIX. RadGridView - InvalidCastException when closing the CompositeFilterForm in a custom GridViewCheckBoxColumn
To reproduce:

public class CustomGridViewCheckBoxColumn : GridViewCheckBoxColumn
        { 
        
        }

CustomGridViewCheckBoxColumn col = new CustomGridViewCheckBoxColumn();
this.radGridView1.Columns.Add(col);
this.radGridView1.EnableFiltering = true;

1. Click the filter button and select "Custom"
2. Close the dialog.

Workaround:

 this.radGridView1.CreateCompositeFilterDialog += radGridView1_CreateCompositeFilterDialog;

private void radGridView1_CreateCompositeFilterDialog(object sender, GridViewCreateCompositeFilterDialogEventArgs e)
{
    e.Dialog = new CustomCompositeFilterForm();
}

public class CustomCompositeFilterForm : CompositeFilterForm
{
    public override void Initialize(GridViewDataColumn dataColumn, FilterDescriptor filterDescriptor, bool useTypedEditors)
    {
        base.Initialize(dataColumn, filterDescriptor, useTypedEditors);
        if (dataColumn is GridViewCheckBoxColumn)
        {
            RadGroupBox groupBox = this.Controls[0] as RadGroupBox;
            groupBox.Controls.Remove(this.RightEditor);
            groupBox.Controls.Remove(this.LeftEditor);
            MethodInfo mi = typeof(CompositeFilterForm).GetMethod("InitializeCheckBoxEditors", BindingFlags.Instance | BindingFlags.NonPublic);
            mi.Invoke(this, null);
        }
    }
}
0 comments