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

Spanning Multiple Dates

2 Answers 77 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 2
Bob asked on 21 Feb 2012, 08:17 PM
I was wondering if it is possible to add appointments in the MonthView where the user has selected (highlighted) a few days.  For example in the picture I have attached, I highlighted Jan 2 - Jan 5.  Is there a property or event that is raised that lets me know if the user has selected several days?

2 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 2
answered on 23 Feb 2012, 10:00 PM

 

 

 

 

function resetDates() {
    //called from code-behind
    var dateStart = window.document.getElementById("<%= DateStart.ClientID %>");
    var dateEnd = window.document.getElementById("<%= DateEnd.ClientID %>");
    dateStart.value = '';
    dateEnd.value = '';
}
  
function OnClientTimeSlotClick(sender, eventArgs) { 
    var startTime = sender._rowSelectionState.rowSelectionStartSlot._startTime; 
    var endTime = sender._rowSelectionState.rowSelectionEndSlot._startTime; 
    var dateStart = window.document.getElementById("<%= DateStart.ClientID %>"); 
    var dateEnd = window.document.getElementById("<%= DateEnd.ClientID %>"); 
    dateStart.value = startTime.toDateString(); 
    dateEnd.value = endTime.toDateString(); 
}

<asp:HiddenField ID="DateStart" runat="server" Value="" />
<asp:HiddenField ID="DateEnd" runat="server" Value="" />
 
 
'*****************************
from code behind:
'*****************************
  
Me.RadAjaxManager1.ResponseScripts.Add("resetDates();")

Add a Radscheduler and you can call the following javascript code from this event in the RadScheduler...

OnClientTimeSlotClick

 

 

="OnClientTimeSlotClick"

 

In my exmaple, I set two hidden fields to get the start and end dates.  Note that if you right click a single date that this event is not fired...

0
Ivana
Telerik team
answered on 24 Feb 2012, 12:48 PM
Hi Bob,

You could use the get_selectedSlots() method of RadScheduler's client object. Here is an example:
function OnClientAppointmentInserting(sender, args) {
    var selectedSlots = sender.get_selectedSlots();
    if (selectedSlots.length > 1) {
        alert(selectedSlots.length);
    }
}
<telerik:RadScheduler ID="RadScheduler1" runat="server" OnClientAppointmentInserting="OnClientAppointmentInserting"
    SelectedView="MonthView">
    <TimeSlotContextMenuSettings EnableDefault="true" />
</telerik:RadScheduler>

I hope this will help.

Greetings,
Ivana
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.
Tags
Scheduler
Asked by
Bob
Top achievements
Rank 2
Answers by
Bob
Top achievements
Rank 2
Ivana
Telerik team
Share this question
or