I am trying to format a GridViewTextBoxColumn that contains a date using format string {0:MM/dd/yyyy}
However its ignoring the format and the 12:00 am is displaying behind the date.
How do i get a GridViewTextBoxColumn to format dates?
Thanks.
Kim
1 Answer, 1 is accepted
0
Nikolay
Telerik team
answered on 06 Sep 2013, 12:57 PM
Hello Kim,
Applying the desired FormatString would work if the value which the FormatString looks up is of type DateTime. However, when you place a DateTime value in a GridViewTextBoxColumn it is being converted to an ordinary string and FormatString has no effect on it. Therefore, if you need to format the value, it should be stored in a GridViewDataTimeColumn which will keep its DateTime type. Alternatively, if you for some reason need to use GridViewTextBoxColumn, you can manually format the shown text using the CellFormatting event:
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely. Sign up for Free application insights >>