DisplayFormat(DataFormatString) not working for properties of navigation properties

0 Answers 17 Views
Grid
Stefan
Top achievements
Rank 1
Iron
Iron
Iron
Stefan asked on 14 May 2025, 06:37 AM

Hi,

wie have a Model A which is related to Model B (1:n). Both have a field of type DateTime with the DisplayFormat-Annotation '[DisplayFormat(DataFormatString = "{0:d}")]'.

If we display both fields in the Details-View of Model A, the formats are applied correctly.

If we display bot fields in a Telerik-GridView, only the format for Model A is applied. Model B shows something like '/Date(1741302000000)/'.

It's important to note, that our application is multilanguage, and we have to support different data formats for each language.

 

How would we go about this? Is this known behaviour?

Ivaylo
Telerik team
commented on 19 May 2025, 05:13 AM

Hi Stefan,

Thank you for reaching out.

I am currently investigating the case, but will need some additional time before I can provide feedback. I will get back to you once I have further details on the matter.

Thank you in advance for your patience.

Regards,
Ivaylo
Progress Telerik

Ivaylo
Telerik team
commented on 19 May 2025, 10:51 AM

Hi, Stefan

Thank you for your patience.

Could you provide a runnable, isolated sample project. Examining this project will let us replicate the issue locally and further troubleshoot it.

In order to help you create the reproducible, I have gone ahead and created a starter project for you. It already has all the dependencies and a view/controller with a Grid.

Please take the following steps:

1. Download and extract the attached solution
2. Open it in  VS2019/2022 and update the following files with your problematic code
2.1 Controllers/GridController.cs
2.2 Views/Home/Index.cshtml
3. Run the project and confirm that it reproduces the problem at runtime
4. Close VS2019/2022, then open the project in File Explorer and delete the bin and obj folders
5. Zip up the solution and attach it to your next reply.

Looking forward to hearing back from you.

Best Regards,
Ivaylo

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Stefan
Top achievements
Rank 1
Iron
Iron
Iron
Share this question
or