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

Specified cast is not valid. error on RadTimePicker value bind to a grid cell

1 Answer 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jose
Top achievements
Rank 2
Jose asked on 12 May 2010, 07:53 PM
 <ItemTemplate>
<telerik:RadTimePicker ClientEvents-OnDateSelected="OnDateSelected"  ID="txt_InD1" runat="server" Width="86"  SelectedDate='<%# Eval("InDay1") %>'    ></telerik:RadTimePicker>
</ItemTemplate>

When I run the project, I get an error on the line above saying "Specific cast is not valid" .  Some values coming from the db are empty strings and I am guessing thats causing this issue.  How can I fix empty strings and null values.  my db field is a char(5) and I am only storing the time values such as 3:31, or 4:30 or 12:58 etc.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 May 2010, 05:28 AM
Hello Robert,

Try using the property DbSelectedDate instead of SelectedDate and see whether it helps you.

<ItemTemplate> 
 <telerik:RadTimePicker DbSelectedDate='<%# Eval("InDay1") %>'
     ClientEvents-OnDateSelected
="OnDateSelected"  ID="txt_InD1" runat="server" Width="86"></telerik:RadTimePicker> 
</ItemTemplate> 

Regards,
Shinu.
Tags
Grid
Asked by
Jose
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or