Debugging DisplayFor Helper

80 Views Asked by At

I am trying to debug my DisplayFor(model => model.dateOfEmp) initally DateTime would display Date + time. To avoid this I added a display template with a ShortDate.

After I added a custom shortdateDisplayFor in the folder DisplayTemplate, it stopped emitting the default css class ID. So I have deleted it the template. However, it still emits the Shortdate and not the full date + time.

Question: I would like to debug this in Visual Studio, and know how can I find out which DisplayFor is being called.?

1

There are 1 best solutions below

0
Fletcher On

To avoid displaying Date + time, you may use DateTime.ToShortDateString Method and define the format via the DisplayFormat attribute: https://stackoverflow.com/a/28115051/5649051

As I tried debugging it, but it seem VS debugging tool could not step into the CSS template.