Set RadTimePicker time interval from C#

2 posts, 1 answers
  1. Shahi
    Shahi avatar
    17 posts
    Member since:
    Apr 2013

    Posted 03 Apr 2013 Link to this post


    I have a RadTimePicker in which I want to set its interval property from the code behind. I had tried setting but everytime
    it is displaying a type conversion error. So can anyone help me how to set the same from code behind?

  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 03 Apr 2013 Link to this post

    Hi Shahi,

    The Interval property of RadTimePicker is of type System.TimeSpan. If you try to set it simply using quotes or using another type such as System.DateTime, you will get a type conversion error. Please check the following sample C# code.

    //setting time interval as 20 minutes. The format is new TimeSpan(hour, minutes, seconds)
    timePicker.TimeView.Interval = new TimeSpan(0, 20, 0);

Back to Top