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

RadDatePicker can't set date under 01/01/1820

5 Answers 377 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Desarrollo
Top achievements
Rank 1
Desarrollo asked on 09 Apr 2013, 06:07 PM
Hi, 

I need some help with a radDatePicker, I can´t set min date to 01/01/1800. I've tried with these properties but nothing I get the error :"No se puede crear un objeto de tipo 'System.DateTime' a partir de su representación de cadena '01/01/1800 12:00:00 a.m.' para la propiedad 'MinDate'."

<telerik:RadDatePicker ID="dtpDesde" runat="server" SkipMinMaxDateValidationOnServer="True" MinDate="01/01/1800 12:00:00 a.m." Calendar-FocusedDate="01/01/1800 12:00:00 a.m." Calendar-RangeMinDate="01/01/1800 12:00:00 a.m." Calendar-RangeSelectionStartDate="01/01/1800 12:00:00 a.m." DateInput-MinDate="01/01/1800 12:00:00 a.m." FocusedDate="01/01/1800 12:00:00 a.m.">


If I only try with the property  "SkipMinMaxDateValidationOnServer="True"" , the control validation in the browser show me an error and  the control clear the date.

Could you please advise me  right way to allow dates under the default min value.

Thanks..

In RadDatePicker

If  not able to select the date less than the 1980, 

5 Answers, 1 is accepted

Sort by
0
Accepted
Vasil
Telerik team
answered on 10 Apr 2013, 07:25 AM
Hi Desarrollo,

The that that you use should be valid string representation to be parsed using DateTime.Parse:
http://msdn.microsoft.com/en-us/library/1k1skd40.aspx
This markup will work for you:
<telerik:RadDatePicker ID="dtpDesde"
    runat="server"
    SkipMinMaxDateValidationOnServer="false"
    MinDate="01/01/1800 00:00:00"
    Calendar-RangeMinDate="01/01/1800 00:00:00"
    Calendar-RangeSelectionStartDate="01/01/1800 00:00:00"
    Calendar-FocusedDate="01/01/1800 00:00:00"
    DateInput-MinDate="01/01/1800 00:00:00"
    FocusedDate="01/01/1800 00:00:00">
</telerik:RadDatePicker>

Greetings,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Desarrollo
Top achievements
Rank 1
answered on 10 Apr 2013, 03:10 PM
Excellent Vasil, it works perfect, Thank you...
Greetings
0
Imran
Top achievements
Rank 1
answered on 28 Apr 2016, 10:11 AM

I want to set 00/00/00  to radDatepicker how can i do this?

 

0
Imran
Top achievements
Rank 1
answered on 28 Apr 2016, 10:12 AM
I want to set 00/00/00  to radDatepicker how can i do this?
0
Vasil
Telerik team
answered on 28 Apr 2016, 12:49 PM
Hi Imran,

The 0/0/0 is not valid year. The years stars from 1, and the months are also from 1 to 12, same as days.
The minimum you can set is 1/1/1, but in case you place it in the markup it will use the ShortYearCenturyEnd is by default 2029 you will end up with 2001/1/1

So you need to set it in the code-behind, here is an example:
<telerik:RadDatePicker runat="server" ID="RadDatePicker1">
</telerik:RadDatePicker>

protected void Page_Load(object sender, EventArgs e)
{
    RadDatePicker1.MinDate = new DateTime(1,1,1);
    RadDatePicker1.SelectedDate = new DateTime(1,1,1);
}

Regards,
Vasil
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Calendar
Asked by
Desarrollo
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Desarrollo
Top achievements
Rank 1
Imran
Top achievements
Rank 1
Share this question
or