Completed
Last Updated: 25 Apr 2013 02:13 by ADMIN
ADMIN
Stefan
Created on: 25 Apr 2013 02:13
Category: GridView
Type: Bug Report
4
FIX. RadGridView - using localized text for CustomFilterDialogTrue and CustomFilterDialogFalse causes exception when applying the fitler
To reproduce, use the following localization provider and set a fitler to a boolean column in RadGridView, via the Custom filtering dialog.

  class MyRadGridLocalizationProvider : RadGridLocalizationProvider
        {
            public const string CustomTrue = "CustomTRUE";
            public const string CustomFalse = "CustomFALSE";

            public override string GetLocalizedString(string id)
            {
                if (id == "CustomFilterDialogTrue")
                {
                    return CustomTrue;
                }
                else if (id == "CustomFilterDialogFalse")
                {
                    return CustomFalse;
                }
                else
                {
                    return base.GetLocalizedString(id);
                }
            }
        }

Workaround - create custom type converter as follows:
        public class MyBooleanConverter : BooleanConverter
        {
            public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
            {
                if (value is string)
                {
                    string text = Convert.ToString(value);

                    if (text == MyRadGridLocalizationProvider.CustomTrue)
                    {
                        return true;
                    }
                    else if (text == MyRadGridLocalizationProvider.CustomFalse)
                    {
                        return false;
                    }
                }
                return base.ConvertFrom(context, culture, value);
            }
        }

and apply it to the check box column:
   radGridView1.Columns["BoolColumn"].DataTypeConverter = new MyBooleanConverter();
0 comments