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

GridViewDateTimeColumn Footer Date Format

1 Answer 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Matthew Compton
Top achievements
Rank 1
Matthew Compton asked on 28 Sep 2012, 03:20 PM
Hello,

I'm having a hard time changing the format in the footer of the Calender.   How can I set the format to {0:yyyy-MM-dd}?

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 29 Sep 2012, 11:58 AM
Hello Mattew,

Thank you for writing

To change the format of the footer in the calendar you need to subscribe to the CellEditorInitialized event of the grid, from where you can access the date time editor and from there the calendar:
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadDateTimeEditor editor = e.ActiveEditor as RadDateTimeEditor;
    if (editor != null)
    {
 
        RadDateTimeEditorElement element = editor.EditorElement as RadDateTimeEditorElement;
        RadDateTimePickerCalendar calendarBehavior = element.GetCurrentBehavior() as RadDateTimePickerCalendar;
        RadCalendar calendar = calendarBehavior.Calendar as RadCalendar;
        calendar.CalendarElement.CalendarStatusElement.LableFormat = "dd/mmm/yyyy";
    }
}

I hope this helps.
 
Greetings,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
GridView
Asked by
Matthew Compton
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or