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

Column bound to DateTime field doesn't handle Time.

2 Answers 67 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joel Palmer
Top achievements
Rank 2
Joel Palmer asked on 06 Mar 2015, 03:36 PM
When I bind a GridViewDataColumn to a DateTime field, I am not allowed to set the Time.  Seems like a reasonable expectation. 

The default state of the column seems to give us the worst of both worlds because the time is displayed when not edited but when we are in edit mode I can't change it.  If the default is just a calendar then don't display the time in the column.  If the default is to handle time then expose the RadDateTimeEditor instead of the RadDateEditor while editing.

How can I accomplish what I want?  Is it a setting in XAML or do I need to capture the column on creation and define it differently?  I'm always appreciative of XAML and Code examples.

Joel.

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 10 Mar 2015, 12:35 PM
Hi Joel,

You can easily update the editing element with the help of a CellEditTemplate like that: 
<telerik:GridViewDataColumn DataMemberBinding="{Binding Established}"
                                           Header="Est."
                                           DataFormatString="{}{0:yyyy}">
                   <telerik:GridViewDataColumn.CellEditTemplate>
                       <DataTemplate>
                           <telerik:RadDateTimePicker SelectedDate="{Binding Established}" />
                       </DataTemplate>
                   </telerik:GridViewDataColumn.CellEditTemplate>
               </telerik:GridViewDataColumn>


Regards,
Maya
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Joel Palmer
Top achievements
Rank 2
answered on 10 Mar 2015, 04:41 PM
Thanks for your reply.  I'll try it out.

Joel.
Tags
GridView
Asked by
Joel Palmer
Top achievements
Rank 2
Answers by
Maya
Telerik team
Joel Palmer
Top achievements
Rank 2
Share this question
or