I have a GridView with a DateTime column. My dates may not have a time part. Using DataFormatString="{0:MM/dd/yyyy hh:mm tt}" will write 12:00 AM when no time was entered. Is there a way to avoid this? That is, if the date has a time setted, then show it, otherwise show just the date?
I have a GridView with a DateTime column. My dates may not have a
Share
You can’t use a conditional with a format string; you have to add an event handler to the GridView’s ItemDataBound event, and format it yourself:
Something like that.