Get all Time Collections list from Rad time picker in codebehind

3 posts, 0 answers
  1. Thenmozhi
    Thenmozhi avatar
    26 posts
    Member since:
    May 2009

    Posted 11 Jan 2011 Link to this post

    Hi,

    I have a rad time picker in my application.

    I am setting start and end time using the radtimepicker.timeview.starttime and endtime .

    And as mentioned above i can able to set the interval as well.

    On button click i have to get the all items from the radtimepicker and have to insert into database.

    Can any one suggest me how to get the time collection from the radtimepicker timeview.

    Thanks
    Thenmozhi
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 12 Jan 2011 Link to this post

    Hello,

    I am not sure about any direct method available for getting the TimeSpan for TimeView. But I tried following code.

    Code:
    protected void Button1_Click(object sender, EventArgs e)
    {
        TimeSpan span = (TimeSpan)RadTimePicker1.TimeView.StartTime;
        TimeSpan interval = (TimeSpan) RadTimePicker1.TimeView.Interval;
        double seconds = RadTimePicker1.TimeView.EndTime.TotalSeconds;
        while (span.TotalSeconds < seconds)
        {          
            string str = span.ToString(); // get the span
            Response.Write(str);
            span = span.Add(interval);
        }
    }




    -Shinu.
  3. Thenmozhi
    Thenmozhi avatar
    26 posts
    Member since:
    May 2009

    Posted 12 Jan 2011 Link to this post

    Hi Shinu,

    Thanks for your response.

    Actually i awaited for the response for a while.

    I have got the list using the below code and completed my task.

     do
            {
               
                dtstart=dtstart.AddMinutes(duration);


            } while (dtstart < dtend);
Back to Top