I am using a Datepicker in a Grid and want to prevent users from selecting date beyond a MinDate.
At first i tried to set it in the ItemDataBound event:
If (TypeOf e.Item Is GridEditableItem) AndAlso (e.Item.IsInEditMode) Then
Dim edititem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
Dim datpkr As RadDatePicker = DirectCast(edititem("DateUpdated").Controls(0), RadDatePicker)
datpkr.MaxDate = DateTime.Today
datpkr.MinDate =DateTime.Today.AddDays(-15)
End If
The issue with this is that the dates are still selectable but i get an "alert" icon in the datepicker box.. I would like the users to try to not select dates beyond mindate. (saves me writing validation code)
I then tried hardcoding the mindate in desgin mode as shown below:
<
telerik:GridDateTimeColumn
DataField
=
"DateUpdated"
HeaderText
=
"DateUpdated"
UniqueName
=
"DateUpdated"
PickerType
=
"DatePicker"
MinDate
=
"03/01/2012"
/>
when i did that, i was not able to select dates before the mindate, which is what i want to do.
Question:
I really need to set the mindate from the server-side (ItemDataBound event) as the mindate would be set to another date field in the database table.
is there a way to "not select dates" les than Mindate from the server side? Or am i doing something wrong?
I did check the forum for a similar issue/solution but did not find something related.
Thanks
Donald
Am using Q1, 2012 version