Selected date not working

3 posts, 0 answers
  1. Brendan Vogt
    Brendan Vogt avatar
    143 posts
    Member since:
    Jun 2008

    Posted 09 Jul 2008 Link to this post

    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. Brendan Vogt
    Brendan Vogt avatar
    143 posts
    Member since:
    Jun 2008

    Posted 09 Jul 2008 Link to this post

    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.
  3. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 09 Jul 2008 Link to this post

    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
Back to Top