Hi
How can I filter radGridView (2012.1.321.40) with BindingList<IPresenceLog> on nullable DateTime field "SystemEnd" to get entries with
SystemEnd.Hasvalue=false? Neither the simple FilterDescriptor nor the DateFilterDescriptor seems to work with any of the available FilterOperators.
//public class PresenceLogModel : PresenceLog, INotifyPropertyChanged, IValidatable
//public class PresenceLog : IPresenceLog
//private BindingList<
IPresenceLog
> _PresenceLogList = new BindingList<
IPresenceLog
>();
private void BindDataSource()
{
if (radGridViewPZE.Columns.Count == 0)
{
radGridViewPZE.MasterTemplate.AutoGenerateColumns = false;
radGridViewPZE.DataSource = _PresenceLogList;
radGridViewPZE.Columns.Add(CommonFunctions.NewTextCol("ResourceNo", "Resource", 100, true));
radGridViewPZE.Columns.Add(CommonFunctions.NewTextCol("ResourceName", "Resourcen Name", 120, true));
radGridViewPZE.Columns.Add(CommonFunctions.NewDateTimeCol("SystemBegin", "Begin", 100, true));
radGridViewPZE.Columns.Add(CommonFunctions.NewDateTimeColWithNull("SystemEnd", "Ende", 100, true));
}
else
radGridViewPZE.DataSource = _PresenceLogList;
}
public static GridViewDateTimeColumn NewDateTimeCol(string fieldname, string title, int width, bool isvisible)
{
GridViewDateTimeColumn col = new GridViewDateTimeColumn(fieldname);
col.Name = fieldname;
col.HeaderText = title;
col.Width = width;
col.IsVisible = isvisible;
col.DataType = typeof(DateTime);
col.FormatString = "{0:dd.MM.yy HH:mm}"; //dd/MM/yyyy HH:mm
return col;
}
public static GridViewDateTimeColumn NewDateTimeColWithNull(string fieldname, string title, int width, bool isvisible)
{
GridViewDateTimeColumn col = new GridViewDateTimeColumn(fieldname);
col.Name = fieldname;
col.HeaderText = title;
col.Width = width;
col.IsVisible = isvisible;
col.DataType = typeof(System.Nullable<
DateTime
>);
col.FormatString = "{0:dd.MM.yy HH:mm}"; //dd/MM/yyyy HH:mm
return col;
}
private void cmbTBFilterOpenEntries_ToggleStateChanged(object sender, StateChangedEventArgs args)
{
if (cmbTBFilterOpenEntries.ToggleState == ToggleState.On)
{
if (resourceFilterOpenEntries == null)
{
//resourceFilterOpenEntries = new DateFilterDescriptor("SystemEnd", FilterOperator.IsEqualTo, new DateTime?(),true);
resourceFilterOpenEntries = new DateFilterDescriptor();
resourceFilterOpenEntries.PropertyName = "SystemEnd";
resourceFilterOpenEntries.Operator = FilterOperator.IsNull; //FilterOperator.IsEqualTo
resourceFilterOpenEntries.Value = null;
//resourceFilterOpenEntries.IsFilterEditor = true;
}
this.radGridViewPZE.FilterDescriptors.Add(resourceFilterOpenEntries);
if (!(radGridViewPZE.EnableFiltering))
radGridViewPZE.EnableFiltering = true;
}
else
{
this.radGridViewPZE.FilterDescriptors.Remove(resourceFilterOpenEntries);
}
}
Any suggestions?
Thanks Daniel