Timer column in GridView that updates every second

3 posts, 1 answers
  1. Chris
    Chris avatar
    2 posts
    Member since:
    May 2014

    Posted 26 Aug Link to this post

    Hello everyone,

    I am trialing Telerik components and am very happy with them so far.  I am attempting to use a GridView component, that is connected to a dataset.  I have created a custom column (currently GridViewTextboxcolumn) and wanted to use an expression that would calculate the number seconds, minutes, hours, and possibly days between now and another column that is read from the dataset. 


    I have done this with the Visual Studio datagridview but I am not actually configuring the GridView via code this time, and simply using bindsource and tableadapter. 


    Does anyone have any pointers on how to accomplish this task, so it would be similar to:


    COL1     COL2     COL3

    UNIT A    2016-08-26 17:00:00      00:18:00

    UNIT B    2016-08-25 08:00:00      1:08:19:03

    00:18:00 would equal 18 minutes

    1:08:19:03 would equal 1 day, 8 hours, 19 minutes, and 3 seconds.

    The status timer (custom column) would have to update every second.




  2. Answer
    Dess avatar
    1562 posts

    Posted 29 Aug Link to this post

    Hello Chris,

    Thank you for writing. 

    In order to display duration in a grid column, you can insert a TimeSpan value. It will be automatically formatted as expected. Please refer to the attached screenshot. Thus, after populating the grid with data, you can add a GridViewTextBoxColumn, iterate all rows and populate the last column's TimeSpan values.

    As to the question about updating the values at a certain interval, feel free to use a Timer in which Tick event you can perform the desired changes.

    I hope this information helps. Should you have further questions I would be glad to help.

    Telerik by Progress
    Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this blog post and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
  4. Chris
    Chris avatar
    2 posts
    Member since:
    May 2014

    Posted 01 Sep in reply to Dess Link to this post

    Thank you!
Back to Top