Completed
Last Updated: 22 Jul 2015 14:32 by ADMIN
ADMIN
Ivan Petrov
Created on: 29 Jun 2015 08:06
Category: GridView
Type: Bug Report
3
FIX. RadGridView - Sorting a date time column containing nulls causes an exception.
Steps to reproduce:

1. Add a GridViewDateTimeColumn to a grid.

2. Add rows where one or more rows should contain null as the columns value.

3. Sort the grid by the date time column. 



WORKAROUND:

Create a custom RadGridDateTimeConverter and assign it as the column's date type converter:

public class CustomRadGridDateTimeConverter : RadGridDateTimeConverter
{
    public CustomRadGridDateTimeConverter(GridViewDateTimeColumn column)
        : base(column)
    { }

    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
    {
        if (destinationType == typeof(DateTime) && value == null)
        {
            return DateTime.MinValue;
        }

        return base.ConvertTo(context, culture, value, destinationType);
    }
}



this.radGridView1.Columns["DateTime"].DataTypeConverter = new CustomRadGridDateTimeConverter(this.radGridView1.Columns["DateTime"] as GridViewDateTimeColumn);
4 comments
ADMIN
Stefan
Posted on: 22 Jul 2015 14:32
The SP date is July 29 - next Wednesday.
Ceki Granti
Posted on: 22 Jul 2015 14:18
Stefan, thank you for this information. Can you please tell the Q2 2015 SP1 release date? This is very important fix and must be implemented to our projects as soon as possible.
Thanks
ADMIN
Stefan
Posted on: 22 Jul 2015 13:42
That is correct, thanks for noticing Ceki. We have the rest of the cases added in the following issue page and a fix for them will also be releases in Q2 2015 SP1: http://feedback.telerik.com/Project/154/Feedback/Details/163498-fix-radgridview-sorting-a-column-containing-nulls-causes-an-exception
Ceki Granti
Posted on: 08 Jul 2015 12:49
Please note that, same problem exists where databinding comes from sql int, real and float datatypes.. ComboColumns which has integer value members has the same sorting problem. Control for all datatypes should be considered.