[quote="NineRays"]I've corrected example to prevent code from exception mentioned:
[c#]
private void InitGrid(FlyGrid grid)
{
//connect to ColumnFilterValidate event
grid.ColumnFilterValidate += new ColumnFilterListValidateHandler(ColumnFilterValidate);
}
private void ColumnFilterValidate(object sender, Column column, ArrayList filterList)
{
if (column.Caption == "Order Date")
{
filterList.Clear();
DateTime end93 = new DateTime(1993, 12, 31);
DateTime end94 = new DateTime(1994, 12, 31);
DateTime end95 = new DateTime(1995, 12, 31);
DateTime end96 = new DateTime(1996, 12, 31);
CultureInfo ivCulture = CultureInfo.InvariantCulture;
FilterItem[] in94Year= new FilterItem[] {
new FilterItem(end93.ToString(ivCulture.DateTimeFormat.ShortDatePattern, ivCulture), FilterOperator.And, ConditionOperator.GreaterThan),
new FilterItem(end94.ToString(ivCulture.DateTimeFormat.ShortDatePattern, ivCulture), FilterOperator.And, ConditionOperator.LessThanOrEqual)
};
FilterItem[] in95Year= new FilterItem[] {
new FilterItem(end94.ToString(ivCulture.DateTimeFormat.ShortDatePattern, ivCulture), FilterOperator.And, ConditionOperator.GreaterThan),
new FilterItem(end95.ToString(ivCulture.DateTimeFormat.ShortDatePattern, ivCulture), FilterOperator.And, ConditionOperator.LessThanOrEqual)
};
FilterItem[] in96Year= new FilterItem[] {
new FilterItem(end95.ToString(ivCulture.DateTimeFormat.ShortDatePattern, ivCulture), FilterOperator.And, ConditionOperator.GreaterThan),
new FilterItem(end96.ToString(ivCulture.DateTimeFormat.ShortDatePattern, ivCulture), FilterOperator.And, ConditionOperator.LessThanOrEqual)
};
filterList.Add(new FilterHelper("[All]", FilterMode.All));
filterList.Add(new FilterHelper("[Custom]", FilterMode.Custom));
filterList.Add(new FilterHelper("Only 1994 year", in94Year));
filterList.Add(new FilterHelper("Only 1995 year", in95Year));
filterList.Add(new FilterHelper("Only 1996 year", in96Year));
}
}