This is a migrated thread and some comments may be shown as answers.

Displaying only date part in DateTime column

3 Answers 167 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ramyashree
Top achievements
Rank 1
Ramyashree asked on 24 Mar 2011, 07:13 AM
Hi,
I have a grid view with a column bound to a field of type DateTime... The column displays both date and time values... I want only date part to be displayed in the column... Can you please let me know how to achieve that...?

3 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 24 Mar 2011, 08:18 AM
Hello Ramyashree,

You may define the the DataFormatString property of the column:
<telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
         Header="Est."
         DataFormatString="{}{0:dd-mm-yyyy}"/>


Greetings,
Maya
the Telerik team
0
Ramyashree
Top achievements
Rank 1
answered on 24 Mar 2011, 01:24 PM
Hi,    

         DataFormatString="{}{0:dd-mm-yyyy}"     is not working.... By default it displays date and time together and while editing it displays only date with a date picker for selecting date.. Once it goes out of editing mode , it displays date along with default time 00:00:00...

Thanks and Regds,
Ramya
0
Maya
Telerik team
answered on 24 Mar 2011, 01:58 PM
Hello Ramyashree,

I am sending you a sample project illustrating the provided solution. Please take a look at it and let me know in case of any misunderstandings.
 

Greetings,
Maya
the Telerik team
Tags
GridView
Asked by
Ramyashree
Top achievements
Rank 1
Answers by
Maya
Telerik team
Ramyashree
Top achievements
Rank 1
Share this question
or