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

setting a time value programmatically in RadDateInput

2 Answers 111 Views
Input
This is a migrated thread and some comments may be shown as answers.
Eric
Top achievements
Rank 1
Eric asked on 27 May 2009, 03:31 PM
I am trying to set a RadDateInput (time) value from a string but keep getting the error
"Text property cannot be set. String was not recognized as a valid DateTime."

I use 

datValue.Text =

value

 

where datValue is my RadDateInput and value is a string containing "09:30"
datValue.DateFormat and DisplayFormat are "HH:mm"

I am missing something obvious?

Thanks

Eric

PS: I use 2009 Q1

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 28 May 2009, 06:35 AM
Hi Eric,

Try the following code for setting the RadDateInput value from code behind.

CS:
 
protected void Button1_Click(object sender, EventArgs e)  
{  
    string str = "09:30";  
    datValue.SelectedDate = Convert.ToDateTime(str);          

Thanks,
Princy.
0
Eric
Top achievements
Rank 1
answered on 28 May 2009, 08:11 AM
It's one of those simple answer that you are so grateful for... apart that they make you feel stupid!

Many Thanks :-)

Eric
Tags
Input
Asked by
Eric
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Eric
Top achievements
Rank 1
Share this question
or