Timeline Drag and Drop - Product Evaluation

2 posts, 0 answers
  1. Serge JR
    Serge JR avatar
    1 posts
    Member since:
    Mar 2011

    Posted 04 Jan 2013 Link to this post

    I am playing around with your controls to see if it meets our needs.
    Right now I cannot seems to drag and drop from external source into the scheduler in TimeLineView.
    On this line :
    Dim table As DayViewAppointmentsTable = (TryCast(Me.RadScheduler1.SchedulerElement.ViewElement, SchedulerDayViewElement)).DataAreaElement.Table 
    the code stops and I got the error
    Object Reference is not set to an instance of object
    Right now I am following the drag and drop sample.
    This is one aspect really important but futhermore I would like to know if it is possible to have this scenario with your control in timeline view

    We got let say 3 Team which are our main ressources. In the schedule with got appointment. I want to drag and drop those appointement from external source (which seems possible). What is tricky is that I also want to drag and drop employee on the Team (ressouces line) to add them on this team (or maybe on the appointment)
    Is it possible with the RadScheduler Control ?

  2. Ivan Todorov
    Ivan Todorov avatar
    688 posts

    Posted 09 Jan 2013 Link to this post

    Hi Serge,

    Thank you for contacting us.

    The code in our documentation works only in day view. In timeline view the view element is not SchedulerDayViewElement and for this reason you are getting the exception. Here is how you can implement your DragDrop handler in order to have it working properly in all views:
    Private Sub radScheduler1_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs)
        Dim point As Point = Me.radScheduler1.PointToClient(New Point(e.X, e.Y))
        Dim schedulerCell As SchedulerCellElement = SchedulerUIHelper.GetCellAtPoint(point, Me.RadScheduler1)
        If schedulerCell IsNot Nothing Then
            Dim dragObject As DragObject = TryCast(e.Data.GetData(GetType(DragObject)), DragObject)
            If dragObject IsNot Nothing Then
                Dim appointment As Appointment = CreateAppointment(schedulerCell.Date, dragObject)
            End If
        End If
        Me.mouseDownPosition = point.Empty
        Me.isDragging = False
    End Sub

    In case you are using grouping, you might also need to get the current resource. You can get it from the hovered cell by using the following code:
    Dim res As IResource = Nothing
    If schedulerCell.View.GetResources().Count > 0 Then
        res = schedulerCell.View.GetResources()(0)
    End If

    In regards to your last requirement, I am not exactly sure how the employees are related to the appointments and the scheduler. As far as I understand, you are using teams as resources and each appointment is associated to a given team. Can you please try to explain in more detail your requirement. You can also include some screenshots or sketches that illustrate it. This will help me understand your scenario and suggest a possible approach.

    Let me know if I can assist you further.

    Kind regards,
    Ivan Todorov
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Back to Top