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

is there to way to show only year in raddatepicker

6 Answers 629 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 04 Jul 2014, 04:13 AM
I want to show only  year on raddatepicker , and the user can enter a value is year.
But it will error if I just enter the value in 2014,but if I enter 01/01/2014, there is no error message.
In the hidden code:
 
  timePicker.Culture.DateTimeFormat = new System.Globalization.DateTimeFormatInfo ShortDatePattern = {"yyyy"};

XAML:
DateSelectionMode = "Year"


Sorry my english :)

6 Answers, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 07 Jul 2014, 08:51 AM
Hello Minh,

When displaying and selecting only years you should also set the ParseExact property of the DatePicker to true:

<telerik:RadDatePicker ParseExact="False" x:Name="Picker" DateSelectionMode="Year" />

Hope this helps.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Minh
Top achievements
Rank 1
answered on 08 Jul 2014, 08:15 AM
Thanks for the reply,
But,I added, but the error is still not resolved :(
0
Minh
Top achievements
Rank 1
answered on 08 Jul 2014, 08:29 AM
it solves one part of my request, so pretty good.
Tks
0
Kalin
Telerik team
answered on 08 Jul 2014, 08:37 AM
Hi Minh,

You would need to enter the whole year in order to parse it correctly. If you have any further questions, let us know.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Minh
Top achievements
Rank 1
answered on 08 Jul 2014, 09:03 AM
It seems that it has 4 mandatory character,
and how to turn off the message "error"?

so, I can check it in LostFocus event
0
Kalin
Telerik team
answered on 10 Jul 2014, 07:49 AM
Hi Minh,

What I can suggest you would be to check the following article from our online help documentation:
http://www.telerik.com/help/wpf/raddatetimepicker-how-to-implement-custom-parsing.html

Using the custom parsing you can implement a custom logic which parses correctly only one, two or three digits. You will avoid the error message when the args.IsParsingSuccessful property is set to true.

Hope this helps.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
DatePicker
Asked by
Minh
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Minh
Top achievements
Rank 1
Share this question
or