RadDateTimePicker/RadDatePicker DbSelectedDate null reference in insertitemtempalte

6 posts, 0 answers
  1. Mira Live
    Mira Live avatar
    4 posts
    Member since:
    Mar 2007

    Posted 26 Aug 2008 Link to this post

    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

  2. John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 26 Aug 2008 Link to this post

    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 />
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mira Live
    Mira Live avatar
    4 posts
    Member since:
    Mar 2007

    Posted 26 Aug 2008 Link to this post

    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
  5. Grendizer
    Grendizer avatar
    51 posts
    Member since:
    Sep 2008

    Posted 06 Apr 2009 Link to this post

    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
  6. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2285 posts

    Posted 06 Apr 2009 Link to this post

    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.
  7. Grendizer
    Grendizer avatar
    51 posts
    Member since:
    Sep 2008

    Posted 07 Apr 2009 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017