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

ExpressionFormattingObject for date GreateOrEqual Today?

2 Answers 190 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Esteban
Top achievements
Rank 1
Iron
Iron
Esteban asked on 27 Sep 2019, 12:05 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Sep 2019, 10:30 AM

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.
0
Esteban
Top achievements
Rank 1
Iron
Iron
answered on 30 Sep 2019, 11:17 AM
Thanks! it ok!
Tags
GridView
Asked by
Esteban
Top achievements
Rank 1
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Esteban
Top achievements
Rank 1
Iron
Iron
Share this question
or