TimePicker handle only minutes

2 posts, 0 answers
  1. Random
    Random avatar
    17 posts
    Member since:
    Feb 2012

    Posted 17 Aug 2012 Link to this post

    Hi.

    I would like to know if its possible to set the TimePicker to handle only minutes?
    So instead of having an input of "01:30" (HH:mm) it should be 90 only.

    Also that the PopUp to pick values, displays as follows

    instead of --> it should be
    00:55 --> 55
    01:00 --> 60
    01:05 --> 65
    and so on...

    Hope you can help me.
  2. Eyup
    Admin
    Eyup avatar
    3005 posts

    Posted 21 Aug 2012 Link to this post

    Hello,

    You could modify the RadDateTimePicker's TimeView items using the following approach:
    protected void RadDateTimePicker1_ItemDataBound(object sender, Telerik.Web.UI.Calendar.TimePickerEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            DateTime cellTime = DateTime.Parse(((e.Item as DataListItem).Controls[0] as HtmlGenericControl).InnerText);
            ((e.Item as DataListItem).Controls[0] as HtmlGenericControl).InnerText = (cellTime.Hour * 60 + cellTime.Minute).ToString();
        }
    }

    For implementing additional custom functionality, you could use the DateInput-ClientEvents-OnValueChanging and DateInput-ClientEvents-OnError events.

    I hope this will prove helpful.

    Kind regards,
    Eyup
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top