Set TimeView.StartTime on the basis of date selection

2 posts, 0 answers
  1. pranav
    pranav avatar
    1 posts
    Member since:
    Apr 2014

    Posted 19 Apr 2014 Link to this post

    Hi Dev,

    Hope you are doing good. I wanted to achieve  below scenario using the RadDateTimePicker under the radgrid where N number of RadDateTimePicker can be added or removed.

    The StartTime of TimeView should change on the basis of date selection. e. g.
    1. All the date before today should not be selectable (Already achieved this using Calendar.RangeMinDate property)
    2. By default (if any date is not selected), the time should start from from 12:00 AM.
    2. If the date is selected as today, and current time is 4:15 PM the timeview should have start with the 4:30 PM.
    3. If date is selected as day after today then time should start from from 12:00 AM.

    I have tried setting StartTime in multiple events but only able to set the StartTime properly in RadGrid_OnItemCreated event. but i am not getting the selecteddate here.

    Thanks !!!

  2. Angel Petrov
    Angel Petrov avatar
    1154 posts

    Posted 23 Apr 2014 Link to this post

    Hello Pranav,

    I am not quite sure what is the relation between the grid and the RadDateTimePicker but I suppose that the last will be used for editing. If that is the case you can subscribe to the OnItemDataBound event and use it to first obtain a reference to the picker and then apply the desired changes.

    Regarding the listed requirements it seems that we should handle only the case where the selected date is the current one. By checking whether the RadDateTimePicker.SelectedDate is the current date and binding the TimeView to a custom collection(as demonstrated here) you should be able to make things work.

    Note that it would be best to provide us with the markup and code-behind of the page so we could further examine the scenario. That would greatly facilitate us in providing a straight to the point solution.

    Angel Petrov

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top