|
Telerik Extensions for ASP.NET MVC |
2012.1.214 |
| .NET version |
4.0 |
| Visual Studio version |
2010 |
| programming language |
C# |
| browser support |
all browsers supported by Telerik Extension for ASP.NET MVC
|
PROJECT DESCRIPTION
This project shows how to keep a DateTime property in UTC format on both server and client sides when using a Grid with Ajax Binding and editing.
Every time a date is being retrieved from the database or received from the client, the DateTime Kind property is left unspecified. The .NET framework implicitly converts such dates to local format.
Similar thing happens on the client side. Browsers convert all dates according to local time.
So in order to keep time in UTC, explicit transformation should be applied to the dates on both client and server sides.
Hence there are two steps to be covered:
- Use a ViewModel with setter and getter that explicitly set the DateTime Kind to UTC.
- Modify the incoming value on the first RowDataBound event, so it shows UTC time properly.