RadDatePicker fails when moved to RadGrid AJAX

5 posts, 1 answers
  1. Kevin Mason
    Kevin Mason avatar
    13 posts
    Member since:
    Jan 2007

    Posted 02 Sep 2009 Link to this post

    This RadDatePicker calendar control works in standard ASP INSERT record form.

              <td style="width:90px;">
                <TRad:RadDatePicker ID="dpDATE_INSTALLATION_INSERT" runat="server"
                                    SelectedDate='<%# Bind("DATE_INSTALLATION","{0:d}") %>' AutoPostBack="False">
                  <Calendar ID="Calendar2" runat="server" Skin="Outlook" ShowRowHeaders="false"
                            BorderStyle="Solid" BorderWidth="1px" BorderColor="Black"
                            TitleStyle-Backcolor="PaleGoldenrod"></Calendar>
                  <DateInput ID="DateInput2" runat="server"
                             DateFormat="dd-MMM-yyyy" DisplayDateFormat="dd-MMM-yyyy" ></DateInput>
                </TRad:RadDatePicker>
              </td> 

    In the insert parameter I use the DateTime datatype.

    When moved to AJAX Rad Grid form it fails when attempting to insert new record inthe Grid Form with error

    "Conversion from string "" to type 'Date' is not valid."

    I did not have to handle NULL or zero-length strings before.
  2. SamJ
    SamJ avatar
    101 posts
    Member since:
    Jul 2008

    Posted 03 Sep 2009 Link to this post

    Hi Kevin,

    Try modifying the RadDatePicker declaration as below:

          <td style="width:90px;">
                <TRad:RadDatePicker ID="dpDATE_INSTALLATION_INSERT" runat="server"
                                    DbSelectedDate='<%# Bind("DATE_INSTALLATION","{0:d}") %>' AutoPostBack="False">
                  <Calendar ID="Calendar2" runat="server" Skin="Outlook" ShowRowHeaders="false"
                            BorderStyle="Solid" BorderWidth="1px" BorderColor="Black"
                            TitleStyle-Backcolor="PaleGoldenrod"></Calendar>
                  <DateInput ID="DateInput2" runat="server"
                             DateFormat="dd-MMM-yyyy" DisplayDateFormat="dd-MMM-yyyy" ></DateInput>
                </TRad:RadDatePicker>
              </td>

    You can also check this demo:
    http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/databinding/defaultcs.aspx

    Regards,
    SamJ



  3. Kevin Mason
    Kevin Mason avatar
    13 posts
    Member since:
    Jan 2007

    Posted 03 Sep 2009 Link to this post

    DbSelectedDate is not available in the latest version of RadAjax DatePicker control.

    Initializing the date in code behind fixed the NULL date error,
    but then when I click Add New Record, the edit column disappears.  ARGG!!
  4. Answer
    SamJ
    SamJ avatar
    101 posts
    Member since:
    Jul 2008

    Posted 03 Sep 2009 Link to this post

    Hi,

    Indeed, the DbSelectedDate property is available in the latested version of the controls. However, it might not appear in the Intelisense list of properties, I an using it successfully on my end just as shown here. And I suggest you to try is as well. Thus the mentioned issues should be solved.

    Regards,
    SamJ
  5. Kevin Mason
    Kevin Mason avatar
    13 posts
    Member since:
    Jan 2007

    Posted 03 Sep 2009 Link to this post

    Yes, Intellisense does not find it,
    but it worked.

    Thanks
Back to Top