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

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

2 Answers 86 Views
DateInput
This is a migrated thread and some comments may be shown as answers.
Rem
Top achievements
Rank 1
Rem asked on 27 Jan 2016, 11:35 PM

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 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 01 Feb 2016, 02:39 PM
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
0
Rem
Top achievements
Rank 1
answered on 01 Feb 2016, 07:22 PM

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

Tags
DateInput
Asked by
Rem
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Rem
Top achievements
Rank 1
Share this question
or