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

Timeline Drag and Drop - Product Evaluation

1 Answer 81 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Serge JR
Top achievements
Rank 1
Serge JR asked on 04 Jan 2013, 04:46 PM
Hi,
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 ?

Thanks

1 Answer, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 09 Jan 2013, 01:56 PM
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
            Me.radScheduler1.Appointments.BeginUpdate()
            Dim appointment As Appointment = CreateAppointment(schedulerCell.Date, dragObject)
            Me.radScheduler1.Appointments.Add(appointment)
            Me.radScheduler1.Appointments.EndUpdate()
        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.
Tags
Scheduler and Reminder
Asked by
Serge JR
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Share this question
or