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

RadTimePicker SelectedTime code behind

2 Answers 150 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Sam
Top achievements
Rank 1
Sam asked on 11 Dec 2013, 02:22 PM
Hello,

Can anyone show me how to bind time from database field?

I tried
RadTimePicker1.SelectedTime = Convert.ToDateTime(dataRow["TimeDeparted"].ToString());

Complied error:
Error   2   Cannot implicitly convert type 'System.DateTime' to 'System.TimeSpan?'

Thank you,
Sam

2 Answers, 1 is accepted

Sort by
0
Accepted
David
Top achievements
Rank 1
answered on 11 Dec 2013, 06:14 PM
According to the documentation, the DbSelectedDate property "Gets or sets the date content of RadTimePicker in a database friendly way."

Try this:
RadTimePicker1.DbSelectedDate = dataRow["TimeDeparted"];
0
Sam
Top achievements
Rank 1
answered on 12 Dec 2013, 01:08 PM
it works!!

Thanks David!
Tags
Calendar
Asked by
Sam
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Sam
Top achievements
Rank 1
Share this question
or