question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DateTimePicker selectedDate throws exception when selected date is null

See original GitHub issue

Hi, Initially am initializing a CustomValue to null for showing Watermark then it is throwing exception i.e String was not recognized as a valid date(converter failed to convert value)

<DateTimePicker Height="25"
   Width="200"
   Focusable="False"
   controls:TextBoxHelper.AutoWatermark="True"
   SelectedDate="{Binding CustomValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
   Margin="5,5"
   HorizontalAlignment="Stretch"/>

How to handle these exception or initially how to show watermark ?

Thanks, Raghav

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
punker76commented, Nov 30, 2017

@Raghava56 It’s a nullable DateTime: public Nullable<DateTime> SelectedDate { get; set; }

0reactions
Raghava56commented, Nov 30, 2017

@punker76 Then why it is throwing exception. if SelectedDate is a nullable data type then it should accept null value.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set Null value in DateTimePicker in C# - Stack Overflow
Just add a checkbox on the date picker, you can find it on properties and set ShowCheckBox to True. You can use this...
Read more >
Validating Empty Date Values in a Date Picker
When datepicker control has no value, the datepicker's selecteddate is blank too. So you could use this to justify. For example: If(!IsBlank( ...
Read more >
Set Datepicker to null / empty throws error?
The error is probably caused by the second date picker component that you added to the template. You need to create both input...
Read more >
DatePicker Runtime Error when Date is outside of Min/Max ...
Hello, One suggestion is to check the date before setting it as the selected value. ... RadDatePicker1.SelectedDate = date;. Thanks, Shinu.
Read more >
RadDatePicker throws error after Ajax: 'this.i3d.length' is null or ...
On page load event I am setting selected date property of datepicker control as current date. RadDatePickerEndDate.SelectedDate = DateTime.Now;.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found