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

RadDateTimePicker/RadDatePicker DbSelectedDate null reference in insertitemtempalte

5 Answers 487 Views
Input
This is a migrated thread and some comments may be shown as answers.
Mira Live
Top achievements
Rank 1
Mira Live asked on 26 Aug 2008, 11:46 AM
Hi!

When using RadDate/RadDateTimePicker in formview insertitemtemplate it´s throwing a null reference exception if no date has been selected.

Code: 

<radControls:DateTimePicker ID="dateTimePicker1" runat="server"

FocusedDate='<%#DateTime.Now %>'

DbSelectedDate='<%#Bind("PremisesStartDate")%>'

TabIndex="4"/>

BR
Marcus

5 Answers, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 26 Aug 2008, 12:30 PM
hi:)

You can find the corresponding online demo following this link:

http://demos.telerik.com/aspnet/prometheus/Calendar/Examples/DatePicker/DataBinding/DefaultCS.aspx




Thank you...
<John:Peel />
0
Mira Live
Top achievements
Rank 1
answered on 26 Aug 2008, 01:33 PM
Hi!

The demo doesn´t apply to my problem, first of all the example only covers EditItemTemplates, with these the DateTimePicker is working as intended. It´s when used in a InsertItemTemplate the problems occur, the issue applies on the numerictextbox as well. All my databinding uses the DbXXX property where available.

I have found a work around but it´s not very nice. Before actually calling my database layer i iterate through the e.values (as received from the insert command generated by the formview) and remove the ones having a datetime value that doesn´t evaluate as a proper datetime value. This is done for the numerictextboxes as well.

BR
Marcus
0
Grendizer
Top achievements
Rank 1
answered on 06 Apr 2009, 03:08 PM
Same for me ^_^

Even with the last control package the issue still persist.

Any update on this issue ?!

Thanks in advance for your answer.

Regards.

Seb
0
Nikolay Rusev
Telerik team
answered on 06 Apr 2009, 04:11 PM
Hello Sebastien,

I am not quite sure how to replicate the problem, but the link below demonstrates how you can use RadDatePicker. It seems to be working as expected with latest release of RadControls for ASP.NET AJAX.

Calendar / Data Binding

Greetings,
Nikolay
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Grendizer
Top achievements
Rank 1
answered on 07 Apr 2009, 09:25 AM
Hi Nikolay,

Thanks for your update on this .. the DbSelectedDate object representation works as expected ... and avoid the APSX parser to raise an exception on invalid cast from DB.NULL to DateTime.

Thanks again for your quick answer.

Seb
Tags
Input
Asked by
Mira Live
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
Mira Live
Top achievements
Rank 1
Grendizer
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Share this question
or