This is a migrated thread and some comments may be shown as answers.

RadGridView, custom filter date with dynamic columns

2 Answers 61 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aldo
Top achievements
Rank 2
Aldo asked on 20 May 2019, 12:58 PM

Hi, i'm trying to implement a custom filter as your example, but in a dynamic columns grid, when i filter i receive this error:

'The binary operator GreaterThanOrEqual is not defined for the types 'System.Object' and 'System.DateTime'.'

On the event 

private void OnFilter(object sender, RoutedEventArgs e)
     {
         this.fromFilter.Value = this.FromDate;
         this.toFilter.Value = this.ToDate;
 
         if (!this.column.DataControl.FilterDescriptors.Contains(this.compositeFilter))
         {
             this.column.DataControl.FilterDescriptors.Add(this.compositeFilter);
         }
 
         this.IsActive = true;
     }

 

i set the dynamic column type like this:

e.Column.ColumnGroupName = "Commercial";
   e.Column.Header = new TextBlock { Text = "Data inserimento", TextAlignment = TextAlignment.Center, TextWrapping = TextWrapping.Wrap, Width = 75, LayoutTransform = new RotateTransform { Angle = -90 } };
   ((GridViewDataColumn)(e.Column)).DataFormatString = "{0:dd-MMM-yy}";
   ((GridViewDataColumn)(e.Column)).DataType = typeof(DateTime?);
   ((GridViewDataColumn)(e.Column)).FilterMemberType = typeof(DateTime?);
   e.Column.FilteringControl = new ucDateFilter { FromDate = DateTime.Now, ToDate =DateTime.Now.AddDays(5)};


2 Answers, 1 is accepted

Sort by
0
Aldo
Top achievements
Rank 2
answered on 21 May 2019, 09:58 AM
Nobody?
0
Vladimir Stoyanov
Telerik team
answered on 23 May 2019, 09:06 AM
Hello Aldo,

Thank you for the provided code snippets.

I tested the described scenario on my end in the CustomFilterControl SDK example, however I was not able to reproduce the observed behavior. That is why I am attaching the sample project, which I used. 

Can you check it out and see how it differs from the setup on your end? Should you need any further assistance, may I ask you to elaborate on what I need to alter in order to replicate the same result in the attached project? This way I will be able to investigate the scenario and better assist you.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Aldo
Top achievements
Rank 2
Answers by
Aldo
Top achievements
Rank 2
Vladimir Stoyanov
Telerik team
Share this question
or