RADScheduler Insert form start time interval--15 min

15 posts, 1 answers
  1. Pavan padavala
    Pavan padavala avatar
    2 posts
    Member since:
    Feb 2010

    Posted 01 Feb 2010 Link to this post

    Hi,

    I am working on RadScheduler and we need 15 min interval in the starttime and end time when creating new Appointment.
    by default it is 30 min.
    1.) Is it possible to change this? If yes how?
    2.) Also, I have a custom resources that can be selected in the drop down below. Is it possible to put a deafult resource when user enters this screen?

    Pls see the attached file.

    Thanks In Advance.
  2. Answer
    Peter
    Admin
    Peter avatar
    6637 posts

    Posted 02 Feb 2010 Link to this post

    Hello Pavan,

    The code that follows will help you achieve both requirements:

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
            if ((e.Container.Mode == SchedulerFormMode.AdvancedEdit) || (e.Container.Mode == SchedulerFormMode.AdvancedInsert))
            {
                RadTimePicker startTime = e.Container.FindControl("StartTime") as RadTimePicker;
                startTime.TimeView.Interval = new TimeSpan(0, 15, 0);
                startTime.TimeView.DataList.DataSource = null;
                startTime.DataBind();
      
                RadTimePicker endTime = e.Container.FindControl("EndTime") as RadTimePicker;
                endTime.TimeView.Interval = new TimeSpan(0, 15, 0);
                endTime.TimeView.DataList.DataSource = null;
                endTime.DataBind();
                if (e.Container.Mode == SchedulerFormMode.AdvancedInsert)
                {
                    RadComboBox resCombo = (RadComboBox)e.Container.FindControl("ResRoom");
                    resCombo.SelectedIndex = 1;
                }
            }
        }

    'Room' is the name of the resource type added to RadScheduler. You need to modify the code with your actual resource name.


    Best wishes,
    Peter
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Pavan padavala
    Pavan padavala avatar
    2 posts
    Member since:
    Feb 2010

    Posted 02 Feb 2010 Link to this post

    Thanks alot Peter. It worked :)
  4. Hai
    Hai avatar
    18 posts
    Member since:
    Nov 2010

    Posted 17 Mar 2011 Link to this post

    Hi,
    I have a question about the Start time and Endtime in Insert/Edit mode. If I select StartTime to be 1 month after today, is there anyway to make the EndTime automatically change to 1 month after.
    For example: by default as I edit an appointment:
    - Start time: 3/17/2011, 9:30 AM.    End Time: 3/17/2011, 10:30 AM
    As I change the Start time to 4/17/2011, time x, the End time should be automatically changed to 4/17/2011, x + 1 hour.

    Kind regards,
    Hai Tran
  5. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 24 Mar 2011 Link to this post

    Hello Hai,

    Thank you for this question.

    Here is one possible solution for this requirement:
    <script type="text/javascript">
          function OnDateSelected(sender, args) {
              var endDatePickerId = document.getElementById("HiddenField1").value;
              var endDatePicker = $find(endDatePickerId);
              endDatePicker.set_selectedDate(args.get_newDate())
          }
      </script>
      <asp:HiddenField ID="HiddenField1" runat="server" />
      <telerik:RadScheduler runat="server" ID="RadScheduler1" OnFormCreated="RadScheduler1_FormCreated"
          StartEditingInAdvancedForm="true" StartInsertingInAdvancedForm="true">
      </telerik:RadScheduler>

    protected void RadScheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
       {
           if (e.Container.Mode == SchedulerFormMode.AdvancedEdit || e.Container.Mode == SchedulerFormMode.AdvancedInsert)
           {
               RadDatePicker startDate = e.Container.FindControl("StartDate") as RadDatePicker;
               startDate.ClientEvents.OnDateSelected = "OnDateSelected";
               RadDatePicker endDate = e.Container.FindControl("EndDate") as RadDatePicker;
               HiddenField1.Value = endDate.ClientID;
               
           }
       }



    Best wishes,
    Peter
    the Telerik team
  6. Hai
    Hai avatar
    18 posts
    Member since:
    Nov 2010

    Posted 25 Mar 2011 Link to this post

    Thank you so much for your solution. It works perfectly.
    I found that when I changed the date on the top of my scheduler, the 2 calendars on the side did not change. They should be synchronized with the selected date of the scheduler. May you show me how to do it?

    King regards,
    Hai Tran 
  7. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 29 Mar 2011 Link to this post

    Hi Hai,

    I don't quite understand what you mean. Can you elaborate and send us a screen capture to illustrate the requirement?


    Kind regards,
    Peter
    the Telerik team
  8. Marc
    Marc avatar
    2 posts
    Member since:
    Aug 2011

    Posted 09 Aug 2011 Link to this post

    Hi, 
    I have to do the same thing, but in the Scheduler WeekView I was able to Change the time interval (See attachment), but is there any way to change the Time Format in the Side bar to show the minutes.
    And have something like this :
    8:00 am
    8:30 am
    9:00 am
    9:30 am

    Instead of :
    8 am      
    8 am
    9 am
    9 am

    Thank you,

    Marc
  9. Peter
    Admin
    Peter avatar
    6637 posts

    Posted 11 Aug 2011 Link to this post

    Hi Marc,

    Please, try the following RadScheduler settings -

    HoursPanelTimeFormat="HH:mm tt"
    MinutesPerRow="15"


    Greetings,
    Peter
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  10. Marc
    Marc avatar
    2 posts
    Member since:
    Aug 2011

    Posted 14 Aug 2011 Link to this post

    Hi Peter,

    That was it! Thank you!

    Regards,

    Marc
  11. shahab
    shahab avatar
    58 posts
    Member since:
    Mar 2009

    Posted 26 Apr 2013 Link to this post

    I use your code but I got an error to set Interval from code:
    "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

    protected void PatientScheduler_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
    protected void PatientScheduler_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
            RadTimePicker startTime = (RadTimePicker)e.Container.FindControl("StartTime");
            RadTimePicker endTime = (RadTimePicker)e.Container.FindControl("EndTime");
            startTime.TimeView.Interval = endTime.TimeView.Interval = new TimeSpan(0, Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]), 0);     
            startTime.DataBind();
            endTime.DataBind();
    }
  12. shahab
    shahab avatar
    58 posts
    Member since:
    Mar 2009

    Posted 26 Apr 2013 Link to this post

    I use your code but I got an error to set Interval from code:
    "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

    protected void PatientScheduler_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
    protected void PatientScheduler_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
            RadTimePicker startTime = (RadTimePicker)e.Container.FindControl("StartTime");
            RadTimePicker endTime = (RadTimePicker)e.Container.FindControl("EndTime");
            startTime.TimeView.Interval = endTime.TimeView.Interval = new TimeSpan(0, Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]), 0);     
            startTime.DataBind();
            endTime.DataBind();
    }
  13. Plamen
    Admin
    Plamen avatar
    3080 posts

    Posted 01 May 2013 Link to this post

    Hello shahab,

     
    Would you please elaborate what are you trying to achieve with the code posted because it is not quite clear from the explanation provided?

    Kind regards,
    Plamen
    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.
  14. shahab
    shahab avatar
    58 posts
    Member since:
    Mar 2009

    Posted 01 May 2013 Link to this post

    "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."

    I got mentioned error when call    endTime.DataBind(); (It is your solution to the problem)
  15. Plamen
    Admin
    Plamen avatar
    3080 posts

    Posted 06 May 2013 Link to this post

    Hi shahab,

     
    It looks like the Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]) in your code is breaking this functionality. You can refer to this help topic where in the Change the start time picker options section is described how we recommend to achieve such customization.

    Kind regards,
    Plamen
    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.
Back to Top