Expression Editor Help

2 posts, 0 answers
  1. Jay
    Jay avatar
    11 posts
    Member since:
    Mar 2012

    Posted 17 Apr 2012 Link to this post

    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?
  2. Nikolay
    Nikolay avatar
    1805 posts

    Posted 18 Apr 2012 Link to this post

    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.

    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top