GridView DataFormatString not working for varchar dates

  • Thread starter Thread starter ronrogell
  • Start date Start date
R

ronrogell

I would like to format a date field in a GridView that is defined as a
varchar. Here is the bound field that I am trying to format. What am
I doing wrong? Can this only be done for DateTime fields?

<asp:BoundField DataField="FILE_PROCESS_DATE" HeaderText="Process Date"
DataFormatString="{0:MM/dd/yyyy}" HtmlEncode="False" />

Thanks,
Ron
 
Hi Ron,

You're right. The formatter won't know how to deal with the value if it
isn't a datetime.

Is it possible to convert the existing string into a DateTime so you can
format it the way you want?

Ken
Microsoft MVP [ASP.NET]
 
Back
Top