RadGridView, custom filter date with dynamic columns

3 posts, 0 answers
  1. Aldo
    Aldo avatar
    42 posts
    Member since:
    Feb 2011

    Posted 20 May Link to this post

    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. Aldo
    Aldo avatar
    42 posts
    Member since:
    Feb 2011

    Posted 21 May Link to this post

    Nobody?
  3. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    405 posts

    Posted 23 May Link to this post

    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.
Back to Top