RadDateInput databind from aspx, want to show empty for null values

3 posts, 1 answers
  1. Rem
    Rem avatar
    54 posts
    Member since:
    Dec 2006

    Posted 27 Jan Link to this post

    I have a RadDateInput control in a user control for a website:

     <telerik:RadDateInput rendermode="lightweight" id="calOneOff" runat="server" EmptyMessage="Enter valid date" DBSelectedDate='<%# Bind("OneOffDate")%>' SkipMinMaxDateValidationOnServer="true"></telerik:RadDateInput>

     

    The original data is from the database, there the OneOffDate field can either have a valid date, or null values.

    As I pick this up in visual studio and store the value in a list of objects, the OneOffDate value is held in a property also called OneOffDate, which is a DateTime datatype.  As a result, the stored value for null values is "01/01/0001" (New Zealand culture, so day/month/year).

    Unfortunately this causes the RadDateInput to show this value (01/01/0001) on the page, along with a little exclamation mark icon (as its too far back in the past to be a valid date).  Is there a way so that if the date is outside a certain range (e.g. before the year 2000) it will show a blank value on the RadDateInput control when databinding?

    Thank you

     

     

  2. Answer
    Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 01 Feb Link to this post

    Hello Rem,

    Try to set the "EnableSmartParsing" property of the DateInput component of the picker control to "false" and see if this helps.

    Regards,
    Maria Ilieva
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rem
    Rem avatar
    54 posts
    Member since:
    Dec 2006

    Posted 01 Feb in reply to Maria Ilieva Link to this post

    Hi Maria,

     Thank you very much, can't believe I missed that property.  This now works as expected, and still "parses" the date correctly if I enter values

Back to Top