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

Set Start and End time of RADTimePicker in grid edit form

3 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Akhil Raj
Top achievements
Rank 1
Akhil Raj asked on 23 Jun 2010, 02:29 PM
hi i am using edit template to edit the grid. In the edit template i used timepicker to select the time with interval of 15 minutes. But i need to restrict the start and end time of that timeview. When i set in design source it will work but when i tried in databound event not working

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 24 Jun 2010, 06:07 AM
Hello Akhil,

Try your code in ItemCreated event than in ItemDataBound event.

ASPX:
<EditItemTemplate> 
    <telerik:RadTimePicker ID="RadTimePicker1" runat="server"
    </telerik:RadTimePicker> 
</EditItemTemplate> 

C#:
 
 protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
        { 
            GridEditFormItem edititem = (GridEditFormItem)e.Item; 
            RadTimePicker timePick = (RadTimePicker)edititem.FindControl("RadTimePicker1"); 
            timePick.TimeView.StartTime = new TimeSpan(8, 0, 0); 
            timePick.TimeView.EndTime = new TimeSpan(9, 0, 0); 
            timePick.TimeView.Interval = new TimeSpan(0, 15, 0); 
        } 
    } 

Thanks,
Princy.



0
Akhil Raj
Top achievements
Rank 1
answered on 24 Jun 2010, 06:37 AM
hi i got using this item created but i need some validation in this control...

I have three different timings like

Case1 : 7:15 am to 3:15 pm
Case2 : 3:15 pm to 12:15 am (end time in next day)

So i need to display times between these times. So in the first case i need to display 7:15 to 15:15 this working nice
In the case 2 how can i fix the end time. our of range exception raised... Please guide me to do this?
0
Akhil Raj
Top achievements
Rank 1
answered on 24 Jun 2010, 08:35 AM
hi friends i finished using add 1 day to the end time span
Tags
Grid
Asked by
Akhil Raj
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Akhil Raj
Top achievements
Rank 1
Share this question
or