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

Set TimeView.StartTime on the basis of date selection

1 Answer 54 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
pranav
Top achievements
Rank 1
pranav asked on 19 Apr 2014, 07:04 AM
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 !!!



1 Answer, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 23 Apr 2014, 03:57 PM
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.

Regards,
Angel Petrov
Telerik
 

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.

 
Tags
General Discussions
Asked by
pranav
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Share this question
or