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

[Solved] out of bounds dates overwritten

0 Answers 17 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Vincent
Top achievements
Rank 1
Vincent asked on 29 Mar 2012, 11:03 PM
Hi,

I am using a DatePicker control on my asp.net MVC 3 (Razor) view with client side validation disabled. The control has been configured with a Min and Max values.

The control seems to automatically overwrite typed in dates that are outside the allowed range, let me give an example:

Here is the control declaration:

Html.Telerik().DatePickerFor(m => m.SelectedEventDate)
.Name(
"SelectedEventDate")
                .Value(Model.SelectedEventDate)
.Min(Model.CurrentApplication.MinSelectableEventDate)//10 days from today
.Max(Model.CurrentApplication.MaxEventDate)// today next year
)

When a user types "01/01/2015" (which is outside the allowed date range), the view model is automatically populated with the maximum allowed date (which is in this case today next year).

How can I disabled this behaviour and have my view model populated with the actual value the user typed in?

Thanks in advance.

Vincent
Tags
Date/Time Pickers
Asked by
Vincent
Top achievements
Rank 1
Share this question
or