Completed
Last Updated: 13 Oct 2015 08:16 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 21 Apr 2015 09:51
Category: GridView
Type: Bug Report
0
FIX. RadGridView - incorrect CheckState when using a RadListFilterPopup with boolean date values for GridViewDateTimeColumn
To reproduce: use the following code snippet and perform the steps illustrated on the attached gif file:

http://www.telerik.com/help/winforms/gridview-filtering-excel-like-filtering.html

public Form1()
{
    InitializeComponent();

    DataTable dt = new DataTable();
    dt.Columns.Add("Id", typeof(int));         
    dt.Columns.Add("Date", typeof(DateTime)); 
    dt.Columns.Add("Name", typeof(string));
    DateTime date;
    for (int i = 0; i < 5; i++)
    {
        date = DateTime.Today.AddDays(i);
        dt.Rows.Add(i,date, "Item." + i );
        date = date.AddHours(2);
        dt.Rows.Add(i,date ,"Item." + i + ".2" );
        date = date.AddMonths(i);
        dt.Rows.Add(i,date, "Item." + i + ".2");
    }

    this.radGridView1.DataSource = dt;
    this.radGridView1.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
    this.radGridView1.EnableFiltering = true;
    this.radGridView1.ShowHeaderCellButtons = true;

    ((GridViewDateTimeColumn)this.radGridView1.Columns[1]).FilteringMode = GridViewTimeFilteringMode.Date;

    this.radGridView1.FilterPopupRequired += radGridView1_FilterPopupRequired;
}

private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
{
    if (e.Column.Name == "Date")
    {
        e.FilterPopup = new RadListFilterPopup(e.Column, true);
    }
}


Workaround:

RadListFilterPopup popup;

private void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
{
    if (e.Column.Name == "Date")
    {
        if (popup == null)
        {
            popup = new RadListFilterPopup(e.Column, true);
        }
        e.FilterPopup = popup;
    }
}
Attached Files:
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments