Spanning Multiple Dates

3 posts, 0 answers
  1. Bob
    Bob avatar
    6 posts
    Member since:
    Nov 2011

    Posted 21 Feb 2012 Link to this post

    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. Bob
    Bob avatar
    6 posts
    Member since:
    Nov 2011

    Posted 23 Feb 2012 Link to this post

     

     

     

     

    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...

  3. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 24 Feb 2012 Link to this post

    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.
Back to Top