I am trying to implement a work schedule using rad scheduler tool.
Everything went good so far until I tried to implement drag and drop on engineer schedule.
I use onAppointmentDataBound to color daily shifts, nothing else.
and to get the information of "start and end times" as well as task id..etc, I am using onAppointmentUpdate at code behind, however I am experiencing a problem such as change in the text of appointment and change the time and color of existing tasks and tooltips of the engineer.
Notice in the screenshots, i am trying to move a task to 17:00 for the same engineer, but scheduler places the task into 15:30 while changing the daily shift (blue task) to something else
In the demos, I couldn't find any examples to specifically handle the drag and drop to avoid such problems.
Any help would be appreciated
Kind regards
Emrah
3 Answers, 1 is accepted
Basically Drag and drop of the appointments is inbuilt functionality and you do no have to implement any other code since you have implemented properly the DataBinding of RadScheduler. Here is a sample demo where is illustrated how it can be working properly in TimelineView.
If you are still having difficulties in implementing it please share the exact mark up and code behind connected to RadScheduler that you are using so we could inspect it and be more helpful.
Plamen
Telerik
Thank you for your reply.
I have already checked most of the demos and related forum topics on the issue but couldn't come across a solution so far.
While trying for different scenarios, I noticed that I encounter with the problem when there's multiple tickets assigned to an engineer (when there are multiple appointments in one row).
In your examples, the query is written on the client side, right under radscheduler definition but I have to work on server side and am dealing with stored procedures. Here's my definition on the client side and the related code on the server side
<telerik:RadScheduler runat="server" ID="radZeitPlan" Width="100%" Height="60%" AllowInsert="false"
SelectedView="TimelineView" DataSubjectField="task" ReadOnly="false" DayStartTime="08:00:00"
DayEndTime="23:00:00" DataKeyField="UserID" DataEndField="endDate" DataStartField="startDate"
OverflowBehavior="Auto" EnableDatePicker="true" Skin="Sunset"
OnAppointmentContextMenuItemClicked="radZeitPlan_AppointmentContextMenuItemClicked"
OnClientAppointmentInserting="onAppointmentInserting" OnTimeSlotContextMenuItemClicked="radZeitPlan_TimeSlotContextMenuItemClicked"
OnAppointmentDataBound="radZeitPlan_AppointmentDataBound"
OnAppointmentUpdate="radZeitPlan_AppointmentUpdate">
<
AdvancedForm
Modal
=
"true"
/>
<
TimelineView
GroupingDirection
=
"Vertical"
ColumnHeaderDateFormat
=
"HH:mm"
SlotDuration
=
"00:30"
NumberOfSlots
=
"35"
StartTime
=
"07:00:00"
HeaderDateFormat
=
"d/M/yyyy"
/>
<
WeekView
GroupingDirection
=
"Vertical"
ColumnHeaderDateFormat
=
"HH:mm"
/>
<
DayView
GroupingDirection
=
"Vertical"
ShowHoursColumn
=
"true"
/>
<
ResourceTypes
>
<
telerik:ResourceType
ForeignKeyField
=
"UserID"
KeyField
=
"UserID"
TextField
=
"fullname"
Name
=
"myResource"
AllowMultipleValues
=
"true"
/>
</
ResourceTypes
>
<
TimeSlotContextMenuSettings
EnableDefault
=
"true"
></
TimeSlotContextMenuSettings
>
<
AppointmentContextMenuSettings
EnableDefault
=
"true"
></
AppointmentContextMenuSettings
>
<
TimeSlotContextMenus
>
<
telerik:RadSchedulerContextMenu
runat
=
"server"
ID
=
"radTimeSlotMenu"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"View Tickets by This FE"
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
TimeSlotContextMenus
>
<
AppointmentContextMenus
>
<
telerik:RadSchedulerContextMenu
runat
=
"server"
ID
=
"radAppointmentMenu"
>
<
Items
>
<
telerik:RadMenuItem
Text
=
"View On Map"
Value
=
"ticket"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"View Tickets by This FE"
Value
=
"byFE"
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Text
=
"View Tickets by This Site"
Value
=
"bySite"
>
</
telerik:RadMenuItem
>
</
Items
>
</
telerik:RadSchedulerContextMenu
>
</
AppointmentContextMenus
>
</
telerik:RadScheduler
>
public void BindSchedule()
{
DataSet ds2 = myObj.GetScheduleData(ddlGroup.SelectedValue); //get daily shifts to be shown in blue
DataSet ds1 = myObj.EngineerDailyAssignmentGet(ddlGroup.SelectedValue); //get engineer tasks
ResourceType t = radZeitPlan.ResourceTypes.FindByName("myResource") as ResourceType;
t.DataSource = ds2; //bind engineer shifts to resource for grouping
radZeitPlan.GroupBy = "myResource";//enable grouping
ds2.Merge(ds1); //merge datasets to be added to resource
radZeitPlan.DataSource = ds2; //bind merged dataset to scheduler
radZeitPlan.DataBind();
}
protected void radZeitPlan_AppointmentDataBound(object sender, SchedulerEventArgs e)
{
if (e.Appointment.Resources.GetResourceByType("myResource") != null)
{
if (e.Appointment.ToolTip.ToString().Substring(0, 2) != "SV")
{
e.Appointment.BackColor = Color.LightBlue;
e.Appointment.AllowEdit = false;
e.Appointment.AllowDelete = false;
}
else
{
e.Appointment.AllowDelete = false;
}
}
}
I actually tried to assign the tickets to another resource but then they did not show up in the scheduler, I ended up getting a scheduler with only the engineers listed on the left but no data inside. It would be really kind of you if you could also help me finding a way to display appointments on the scheduler without binding the entire data using radScheduler.DataSource. and as I said the demos didn't work for me since I am working on the server-side.
In this scenario we strongly recommend following the structure that we use in this on-line demo and that is explained in this help topic when you use DataSource property of RadScheduler. Please don't forget to implement the insert, update and delete methods of RadScheduler because otherwise the drag and drop may not work properly.
Hope this will be helpful.
Plamen
Telerik