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

no future date in the RadDatepicker when input date from keyboard

1 Answer 461 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
nguyen
Top achievements
Rank 1
nguyen asked on 19 Dec 2011, 05:29 AM
Dears, 

 I've a RadDatePicker Control with 'no date in the future can be set', when i using this code: 
 <telerik:RadDatePicker Width="85"  EnableEmbeddedSkins="false" ID="RadDatePicker1 " runat="server">
                                       <DateInput runat="server">
                                        </DateInput>
    </telerik:RadDatePicker>
and code behind: 
RadDatePicker1.MaxDate = DateTime.Now

when i input date by DatePicker (using code RadDatePicker1.MaxDate = DateTime.Now ), function running properly. But when i input date data by keyboard, date in the future can be set normally.

please help me fix error when i input 'future date' data from keyboard, the 'dateinput' can be set.

thanks,

 
 

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 19 Dec 2011, 10:42 PM
If you were using embedded skins, then you would be able to disable users from picking a future date quite easily by setting the RadDatePicker1.MaxDate = DateTime.Now; in the Page_Load event. Then, you are not able to use the pop-up Calendar to select a date in the future and attempt to use the keyboard to type it out manually shows validation issue when the onblur() event occurs on the input element of the RadDatePicker.
protected void Page_Load(object sender, EventArgs e)
  
{
  
    RadDatePicker1.MaxDate = DateTime.Now;
  
}

However,  if you are setting EnableEmbeddedSkins=”false” it removes the validation CSS. In this particular case, you will need to dig out the CSS associated with that part of the component and implement it in your custom skin. Otherwise, users will still be able to type in future dates manually.

Cheers!
Tags
General Discussions
Asked by
nguyen
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or