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

Custom date format

4 Answers 121 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Stas
Top achievements
Rank 1
Stas asked on 28 Oct 2010, 08:49 AM
Hi,
I'm using RadDateTimePicker with InputMode="DatePicker".
I need to set custom date format (MMddyyyy):
datePicker.Culture = new CultureInfo("en-US")
{
    DateTimeFormat = new DateTimeFormatInfo
    {
        ShortDatePattern = "MMddyyyy",
    }
};
datePicker.DisplayFormat = DateTimePickerFormat.Short;

But when enter something in this format (e.g. 10282010), the control doesn't treat it as a valid date.
Is there any way how to deal with this issue?

4 Answers, 1 is accepted

Sort by
0
Stas
Top achievements
Rank 1
answered on 28 Oct 2010, 11:21 AM
It looks like RadDateTimePicker expects some delimeter, so the problem is solved by a special behavior that handles
ParseDateTimeValue event and  parses input string own way. Thanks for exposing these internals.
Standard Silverlight controls are very badly extensible. 
0
Kaloyan
Telerik team
answered on 02 Nov 2010, 09:43 AM
Hi Stas,

We assume that there might be a certain scenarios that doesn't confirm the customer's expectation. So the purpose of the following event - "ParseDateTimeValue" is to give the ability in the user's hands to overcome a situation like yours. Sorry if this is causing you some troubles.

Sincerely yours,
Kaloyan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daní
Top achievements
Rank 1
answered on 15 Nov 2010, 05:50 PM
I'm trying to implement this feature in a Behavior but it's crashing whenever a date is selected. I'm using the DateTimePicker in DatePicker InputMode and Month DateSelectionMode and I want to customize the DateText to not show the day, just month and yera ("MM/yyyy"). ParseDateTimeValue event is never called and I'm getting a PareseException related to some missing delimeters.
0
Kaloyan
Telerik team
answered on 17 Nov 2010, 03:40 PM
Hi DanĂ­,

Can you share a fragment from your behavior that is showing the exception you are getting.

Greetings,
Kaloyan
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
Tags
DateTimePicker
Asked by
Stas
Top achievements
Rank 1
Answers by
Stas
Top achievements
Rank 1
Kaloyan
Telerik team
Daní
Top achievements
Rank 1
Share this question
or