setting a time value programmatically in RadDateInput

3 posts, 1 answers
  1. Eric
    Eric avatar
    82 posts
    Member since:
    Feb 2009

    Posted 27 May 2009 Link to this post

    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. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 28 May 2009 Link to this post

    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.
  3. Eric
    Eric avatar
    82 posts
    Member since:
    Feb 2009

    Posted 28 May 2009 Link to this post

    It's one of those simple answer that you are so grateful for... apart that they make you feel stupid!

    Many Thanks :-)

    Eric
Back to Top