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

GridDateTimeColumn with TimePicker

1 Answer 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ryan
Top achievements
Rank 1
ryan asked on 06 Nov 2008, 03:03 PM
I can not get the interval to change for a GridDateTimeColumn with the picker set to TimePicker.  I don't get any errors but the interval stays at 1 hour.

here is my code

protected void AddressGrid_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
        { 
             
            GridEditableItem item = (GridEditableItem)e.Item; 
            RadDateTimePicker DoNotCallMinuteEnd = (RadDateTimePicker)item["DoNotCallMinuteEnd"].Controls[0]; 
            DoNotCallMinuteEnd.TimeView.Interval = new TimeSpan(00, 30, 00); 
            RadDateTimePicker DoNotCallMinuteBegin = (RadDateTimePicker)item["DoNotCallMinuteBegin"].Controls[0]; 
            DoNotCallMinuteBegin.TimeView.Interval = new TimeSpan(00, 30, 00); 
        } 
    }  



<telerik:GridDateTimeColumn HeaderText="begin Time To Call" UniqueName="DoNotCallMinuteBegin" DataField="FormatedEndTime"  
PickerType="TimePicker" DataType="System.TimeSpan"  >  
</telerik:GridDateTimeColumn> 
<telerik:GridDateTimeColumn HeaderText="end Time To Call" UniqueName="DoNotCallMinuteEnd" DataField="FormatedEndTime" 
  PickerType="TimePicker" DataType="System.TimeSpan" > 
</telerik:GridDateTimeColumn> 

1 Answer, 1 is accepted

Sort by
0
Missing User
answered on 10 Nov 2008, 11:07 AM
Hello ryan,


You should use the SharedTimeView property to set the interval. Here is an example:

    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if ((e.Item is GridEditableItem) && (e.Item.IsInEditMode)) 
        { 
            GridEditableItem item = (GridEditableItem)e.Item; 
            RadDateTimePicker DoNotCallMinuteEnd = (RadDateTimePicker)item["DoNotCallMinuteEnd"].Controls[0]; 
            DoNotCallMinuteEnd.SharedTimeView.Interval = new TimeSpan(00, 30, 00); 
            RadDateTimePicker DoNotCallMinuteBegin = (RadDateTimePicker)item["DoNotCallMinuteBegin"].Controls[0]; 
            DoNotCallMinuteBegin.SharedTimeView.Interval = new TimeSpan(00, 30, 00);  
        }  
    } 


Please, give it a go and let us know if the problem is resolved.

Regards,
Plamen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
ryan
Top achievements
Rank 1
Answers by
Missing User
Share this question
or