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

2 posts, 0 answers
  1. Alain
    Alain avatar
    33 posts
    Member since:
    Feb 2009

    Posted 17 Apr 2012 Link to this post

    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

     
  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 20 Apr 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top