Set Start and End time of RADTimePicker in grid edit form

4 posts, 1 answers
  1. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 23 Jun 2010 Link to this post

    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
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Jun 2010 Link to this post

    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.



  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 24 Jun 2010 Link to this post

    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?
  5. Akhil Raj
    Akhil Raj avatar
    69 posts
    Member since:
    Aug 2012

    Posted 24 Jun 2010 Link to this post

    hi friends i finished using add 1 day to the end time span
Back to Top