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

Display a date column by Time Zone

2 Answers 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 21 Feb 2009, 04:55 PM
Hello,

I am working on several grids that contain a date column.  In the database the date/time is in UTC. I have a method that converts the UTC date to any time zone specified. I have a control that allows the user to select  a time zone.  I would like to show the date in the specified time zone. If the user changes the time zone the date column updates.

My prototype creates a DataTable in code behind and calculates the data as it populates the rows.

Do you think this is the best way? It seems like there should be a way to hook into the onDisplay event for that field and modify it as it is being displayed.  That would be cleaner and allow use of the field property editors.

Thanks

Barry

2 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 24 Feb 2009, 11:51 AM
Hello Barry,

There are two options to handle this. The first would be to iterate through the dataItems in the grid, and alter the value, depending on the time zone. However, this information would simply be displayed to the user. It would not reflect the actual information coming from the database. The proper approach would be to modify directly the underlying datasource, and rebind the control to reflect this data. This would also allow for its editing.
I hope this suggestion helps.

All the best,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Barry
Top achievements
Rank 1
answered on 27 Feb 2009, 01:33 PM
I was able to get it all working.

Thanks for the advise.

Barry
Tags
Grid
Asked by
Barry
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Barry
Top achievements
Rank 1
Share this question
or