Set RadComboBox value base on RadTimePicker

2 posts, 0 answers
  1. Jesus
    Jesus avatar
    2 posts
    Member since:
    Aug 2012

    Posted 28 Apr 2011 Link to this post

    Hi,

    I have RadComboBox which I want to have a value base on the time selected on RadTimePicker1 with interval of 15 mins. Let say I select 4:00 PM on RadTimePicker1 ,  RadComboBox value should be 3:45 PM, 3:30 PM, 3:15 PM and so on...

    Pls. provide sample code on Code-behind C# or Javascript.

    TIA
  2. Jesus
    Jesus avatar
    2 posts
    Member since:
    Aug 2012

    Posted 28 Apr 2011 Link to this post

    Update: I was able to get through this code, just need to format the e.get_newTime() on its time:hour minute format only then the interval of 15 mins.

     var combo = $find('<%=RadTimePicker1.ClientID%>');
     var items = combo.get_items();
     combo.trackChanges();
     var comboItem = new Telerik.Web.UI.RadComboBoxItem();
     comboItem.set_text(e.get_newTime().toString());
      comboItem.set_value(e.get_newTime().toString());
     items.insert(0, comboItem);            
     combo.commitChanges();
Back to Top