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

Selected date not working

2 Answers 165 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Brendan Vogt
Top achievements
Rank 1
Brendan Vogt asked on 09 Jul 2008, 12:08 PM
Hi,

I am trying to set the SelectedDate property for my date picker which comes out of a XML file.  But the error that I keep on getting is:

Specified cast is not valid.

The date is in the format of 2008/01/01 in my XML file.

Here is my code:

<radG:GridTemplateColumn
   HeaderText="Date Of Deposit"
   UniqueName="DateOfDeposit">
   <ItemTemplate>
      <asp:Label ID="lblDateOfDeposit" runat="server" Text='<%# Eval("DateOfDeposit") %>'></asp:Label>
   </ItemTemplate>
   <EditItemTemplate>
      <radCln:RadDatePicker
         ID="rdDateOfDeposit"
         SelectedDate='<%# Eval("DateOfDeposit") %>'
         runat="server">
         <DatePopupButton
           HoverImageUrl="~/RadControls/Calendar/Skins/Default/Img/datePickerPopupHover.gif"
           ImageUrl="~/RadControls/Calendar/Skins/Default/Img/datePickerPopup.gif" />
      </radCln:RadDatePicker>
   </EditItemTemplate>
</radG:GridTemplateColumn>

Please can someone help me?

Thanks
Brendan

2 Answers, 1 is accepted

Sort by
0
Brendan Vogt
Top achievements
Rank 1
answered on 09 Jul 2008, 12:37 PM
Hi,

I got to the solution of this error.  But this is the second control that I come across where I had to set a property that wasn't in the intellisense but it had to be set!!  Are these bugs?

DbSelectedDate='<%# DataBinder.Eval(Container.DataItem, "DateOfDeposit") %>'

Now the next issue that I am having is that if the date comes in as an empty string then I want the date picker's textbox to be blank.

Please help.
0
Vlad
Telerik team
answered on 09 Jul 2008, 01:33 PM
Hello Brendan,

DbSelectedDate is similar to SelectedValue of standard Microsoft GridView control. You can set this only with binding expression.

All the best,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Calendar
Asked by
Brendan Vogt
Top achievements
Rank 1
Answers by
Brendan Vogt
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or