ExpressionFormattingObject for date GreateOrEqual Today?

3 posts, 1 answers
  1. Esteban
    Esteban avatar
    9 posts
    Member since:
    Nov 2010

    Posted 27 Sep 2019 Link to this post

    Hello

    This works ok :

            Dim obj1 As New ExpressionFormattingObject("MyCondition1", "MYDATE IS NULL", True)
          obj1.CellBackColor = Color.YellowGreen
          PeriodosGridView.Columns("MYDATE").ConditionalFormattingObjectList.Add(obj1)

    But y need create ExpressionFormattingObject for detect when a value is greater than today

    Is possible?

    Thanks

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3575 posts

    Posted 30 Sep 2019 Link to this post

    Hello, Esteban,   

    The ExpressionFormattingObject expects a fixed value for the expression like below:

            Dim obj1 As New ExpressionFormattingObject("MyCondition1", "CreatedOn > #09/30/2019#", True)
            obj1.CellBackColor = Color.YellowGreen
            Me.RadGridView1.Columns("CreatedOn").ConditionalFormattingObjectList.Add(obj1)

    You can construct  the expression at run time considering the value of DateTime.Today.

    An alternative solution that I can suggest is to handle the CellFromatting event where you have direct access to the CellElement.Value property and can add an if statement checking the date value of the respective cell. Please refer to the following help article which demonstrates how you use the event and apply the desired style to the respective cells: https://docs.telerik.com/devtools/winforms/controls/gridview/cells/formatting-cells

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess | Tech Support Engineer, Sr.
    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.
  3. Esteban
    Esteban avatar
    9 posts
    Member since:
    Nov 2010

    Posted 30 Sep 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Thanks! it ok!
Back to Top