Version

Edit and Display Mode Formats in WebDatePicker

WebDatePicker™ allows you to specify different format strings for when the control is in edit and display modes. You can set the format of the date used for edit mode (i.e. when the control has input focus) by simply setting the control’s EditModeFormat property. Similarly, you can set the format of the date used for display mode (i.e. when the control doesn’t have input focus) by simply setting the control’s DisplayModeFormat property.

Note
Note:

EditModeFormat and DisplayModeFormat properties depend on the System.Globalization.DateTimeFormatInfo class.

You can set the EditModeFormat and DisplayModeFormat properties either by using the Microsoft® Visual Studio® Property Window or by using the following code:

In Visual Basic:

'Create a DateTimeFormatInfo object
Dim format As New System.Globalization.DateTimeFormatInfo()
'Set the EditModeFormat property of WebDatePicker to the pattern you want
WebDatePicker1.EditModeFormat = format.ShortDatePattern
'Set the DisplayModeFormat property of WebDatePicker to the pattern you want
WebDatePicker1.DisplayModeFormat = format.LongDatePattern

In C#:

//Create a DateTimeFormatInfo object
System.Globalization.DateTimeFormatInfo format = new System.Globalization.DateTimeFormatInfo();
//Set the EditModeFormat property of WebDatePicker to the pattern you want
WebDatePicker1.EditModeFormat = format.ShortDatePattern;
//Set the DisplayModeFormat property of WebDatePicker to the pattern you want
WebDatePicker1.DisplayModeFormat = format.LongDatePattern;

EditMode:

WebDatePicker Edit and Display Modes in WebDatePicker 01.png

DisplayMode:

WebDatePicker Edit and Display Modes in WebDatePicker 02.png