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

RadDatePicker fails when moved to RadGrid AJAX

4 Answers 70 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Kevin Mason
Top achievements
Rank 1
Kevin Mason asked on 02 Sep 2009, 07:50 PM
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.

4 Answers, 1 is accepted

Sort by
0
SamJ
Top achievements
Rank 1
answered on 03 Sep 2009, 06:18 AM
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



0
Kevin Mason
Top achievements
Rank 1
answered on 03 Sep 2009, 03:52 PM
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!!
0
Accepted
SamJ
Top achievements
Rank 1
answered on 03 Sep 2009, 04:26 PM
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
0
Kevin Mason
Top achievements
Rank 1
answered on 03 Sep 2009, 09:05 PM
Yes, Intellisense does not find it,
but it worked.

Thanks
Tags
Calendar
Asked by
Kevin Mason
Top achievements
Rank 1
Answers by
SamJ
Top achievements
Rank 1
Kevin Mason
Top achievements
Rank 1
Share this question
or