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

How to empty RadDatePicker text box with DateTime.MinValue binding value

1 Answer 189 Views
Input
This is a migrated thread and some comments may be shown as answers.
Alain
Top achievements
Rank 1
Alain asked on 17 Apr 2012, 05:57 PM
Hello,

ASP.NET Ajax: 2012.1.215.40

I used a bounded RadDatePicker inside a DetailsView with the following parameters:
<telerik:RadDatePicker ID="Test" runat="server" SelectedDate='<%#Bind("Birthday") %>' SkipMinMaxDateValidationOnServer="true" MinDate="1900-01-01"></telerik:RadDatePicker>

Initially, the "Birthday" property from datasource is DateTime.MinValue. 

When I turn the DetailsView from ReadOnly to Edit mode, the RadDatePicker text box displays the value "01/01/0001 00:00:00" and its border becomes red with a warning triangle in the right.

I would like that when my "Birthday" property is set to DateTime.MinValue and the DetailsView is bound in Edit mode, the RadDatePicker empties its text box in place of displaying the red border. But when the user enters a date smaller than MinDate, the normal behaviour remains, ie red border is displayed.

How can I do this?

Thank you,
Alain

 

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 20 Apr 2012, 12:15 PM
Hello Alain,

Possible approach in this case is to use the FormView ItemCreated event, check of the item is in edit mode, find the mentioned Datepicker control and call its Clear() method to clear its initial value.


Greetings,
Maria Ilieva
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.
Tags
Input
Asked by
Alain
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or