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

How is it possible to throw an exception with SelectedDate, if its new value is Nothing?

4 Answers 42 Views
DateTimePicker
This is a migrated thread and some comments may be shown as answers.
Nicolas
Top achievements
Rank 1
Nicolas asked on 23 Sep 2015, 06:34 PM

Hello,

In the DbSelectedDate property documentation, it is stated that it behaves exactly like the SelectedDate property. The only difference is that it will not throw an exception if the new value is null or DBNull.

http://www.telerik.com/help/sitefinity/developer-manual/radcalendar.net2-telerik.webcontrols.raddatepicker-dbselecteddate.html

It is also stated that null in C# is Nothing in VB. I use VB and cannot see how SelectedDate can throw an exception if its new value is Nothing. I tried this:
ctlRadDateTimePicker.SelectedDate = Nothing

How is it possible to throw an exception? Why there is this remark?

Best regards,
Nicolas

4 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 28 Sep 2015, 10:41 AM
Hi Nicolas,

You can check the pickers in the following live sample:
http://demos.telerik.com/aspnet-ajax/grid/examples/data-editing/form-template-update/defaultcs.aspx

If the SelectedDate property is used instead, a server-side exception may be thrown when opening the insert form for example. You can also test that with a RadNumericTextBox with Value and DBValue.

Regards,
Eyup
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
Nicolas
Top achievements
Rank 1
answered on 29 Sep 2015, 07:09 PM
Hello Eyup,

Thank you for answering.

You shown me an example with databound control.

However, is it possible to raise an exception only by assigning value to RadDateTimePicker SelectedDate property?

We have a problem here and nobody is able to reproduce it. It seems to occur while assigning a date. Our control is not bound to any dataset. We assign the value in the code. So I thought that it might be caused by SelectedDate. When I saw the DBSelectedDate documentation stating that an exception might be raised, I believed that it might be related.

Text_property_cannot_be_set._String_was_not_recognized_as_a_valid_DateTime. Text_property_cannot_be_set._String_was_not_recognized_as_a_valid_DateTime. ___at_Telerik.Web.UI.RadDateInput.RangeTextProperty(String_value) ___at_Telerik.Web.UI.RadDateInput.set_Text(String_value) ___at_Telerik.Web.UI.DatePickingInput.LoadPostData(String_postDataKey,_NameValueCollection_postCollection) ___at_System.Web.UI.Page.ProcessPostData(NameValueCollection_postData,_Boolean_fBeforeLoad) ___at_System.Web.UI.Page.ProcessRequestMain(Boolean_includeStagesBeforeAsyncPoint,_Boolean_includeStagesAfterAsyncPoint)

Best regards,

Nicolas
0
Eyup
Telerik team
answered on 02 Oct 2015, 08:34 AM
Hello Nicolas,

Could you prepare a new web site sample to isolate the issue and open a formal support ticket to send it to us? Thus, we will be able to further analyze and debug the project and try to determine the cause of the problem.

Regards,
Eyup
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
Nicolas
Top achievements
Rank 1
answered on 02 Oct 2015, 11:56 AM
Hello Eyup,

Thank you for answering.

OK, I will try to reproduce the issue with a sample. I will open a support ticket if I succeed to reproduce it.

Best regards,

Nicolas
Tags
DateTimePicker
Asked by
Nicolas
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Nicolas
Top achievements
Rank 1
Share this question
or