If I remove .LocalDateTime it works but then it shows the incorrect local time.
1 Answer, 1 is accepted
1
Accepted
Justin
Telerik team
answered on 25 Apr 2023, 06:33 PM
Hi Henrik,
Try calling the LocalDateTime method on the Dto.DateTimeOffset field in a Column Template like this:
<GridColumnField="@nameof(Product.Released)"Title="Released" ><Template>
@{
var product = context as Product;
var time = product.Released;
<span>@time.LocalDateTime.ToString("F")</span>
}
</Template></GridColumn>
Is there anyway to simplify/reuse it because I need todo it in a lot of places with multiple dates per grid?
Regards,
Henrik
Dimo
Telerik team
commented on 28 Apr 2023, 08:35 AM
@Henrik - there are a couple of options -
Add one more property in the Grid model class, which has a custom getter and returns the above expression. Bind the column to that property. In this case you won't need a column template, but all data operations for this column will start working on a string property.