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

Expression Editor Help

1 Answer 119 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jay
Top achievements
Rank 1
Jay asked on 17 Apr 2012, 08:53 PM
I'm trying to add an expression to a column. The Grid is bound to a table which has a data column expiration date. now i don't want to display the expiration date but how many days til it expires. I tried to use the expression editor function
DATEDIFFDAY(Today(),GetDate(QuoteExpireDate))  QuoteExpireDate is the column in the database. What am  i doing wrong?

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 18 Apr 2012, 09:18 AM
Hi Jay,

Thank you for this question.

Your expression is correct. However, please note that you should create a new GridViewDecimalColumn to accommodate the expression. The expression returns a numeric value rather than date-time one and you will not achieve your requirement if you set it to your GridViewDateTimeColumn that accepts DateTime values only. I am attaching a sample project based on my words. As you can see there, I have a separate column (GridViewDecimalColumn - column2) which displays the remaining days getting the expiration date from column1 (GridViewDateTimeColumn). Further, you can just hide column1 by setting its IsVisible property to false:

this.radGridView1.Columns["column1"].IsVisible = false;

I hope this helps.

Greetings,
Nikolay
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Jay
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or