DateTimePicker selectedDate throws exception when selected date is null
See original GitHub issueHi, 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:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Raghava56 It’s a nullable DateTime:
public Nullable<DateTime> SelectedDate { get; set; }
@punker76 Then why it is throwing exception. if SelectedDate is a nullable data type then it should accept null value.