cell time FormatString

1 Answer 25 Views
DateTimePicker GridView
ebrahim
Top achievements
Rank 1
Iron
Iron
ebrahim asked on 23 Jan 2022, 03:28 PM

hi

how show cell time like hh:mm

this code have error
GridViewDateTimeColumn column = (GridViewDateTimeColumn)this.radGridView1.Columns["Date"];

column.FormatString = "{0:hh.mm}";      //hour.minutes
thanks

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 24 Jan 2022, 02:33 PM

Hello, Ebrahim,   

Setting the GridViewDateTimeColumn.FormatString property controls how the cells will be formatted when the cell is not in edit mode. For the editor's format, set the Format property of the column to Custom and the CustomFormat property of the column to a desired format: 

            GridViewDateTimeColumn column = (GridViewDateTimeColumn)this.radGridView1.Columns["OrderDate"]; 
            column.FormatString = "{0:hh.mm}";
            column.Format = DateTimePickerFormat.Custom;
            column.CustomFormat = "hh.mm";

https://docs.telerik.com/devtools/winforms/controls/gridview/columns/column-types/gridviewdatetimecolumn

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DateTimePicker GridView
Asked by
ebrahim
Top achievements
Rank 1
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or