Hi there, I am encountering a couple of problems using the scheduler and am wondering if anyone can help.
The first one is that I cannot seem to get appointments to show up under their appropriate resources. Without resources, the scheduler displays the appointments fine. Here is the code, see if you can see what I'm doing wrong:
Initializing resources:
Initializing appointments:
The scheduler markup (although I am doing all of the work in code-behind, here's the markup so you can see what I'm doing):
Now I don't know what I'm doing wrong, I thought the foreign key field of "VehicleID" should allow appointments to be auto-assigned to their appropriate resources based on their "VehicleID" column value? Or do I need to do more than this?
Any help is greatly appreciated, sorry if I've missed something really obvious :)
The other problem is a very simple one - is it possible to assign separate start and end availability times for each resource? ie each Vehicle on my scheduler will have a shift start/end time, and I want this to be reflected on the scheduler.
The first one is that I cannot seem to get appointments to show up under their appropriate resources. Without resources, the scheduler displays the appointments fine. Here is the code, see if you can see what I'm doing wrong:
Initializing resources:
ResourceType resType =
new
ResourceType(
"Vehicle"
);
resType.ForeignKeyField =
"VehicleID"
;
tripScheduler.ResourceTypes.Add(resType);
Vehicle[] vehicles = Vehicle.GetVehiclesForDate(DateTime.Parse(txtDate.Text));
foreach
(Vehicle vehicle
in
vehicles)
tripScheduler.Resources.Add(
new
Resource(
"Vehicle"
, vehicle.ID, vehicle.SummaryTextLong));
Initializing appointments:
Trip[] clientTrips_scheduled = Trip.GetTripsForDate(date,
true
);
DataTable scheduledTripsTable =
new
DataTable();
scheduledTripsTable.Columns.Add(
"ID"
);
scheduledTripsTable.Columns.Add(
"Title"
);
scheduledTripsTable.Columns.Add(
"Start"
);
scheduledTripsTable.Columns.Add(
"End"
);
scheduledTripsTable.Columns.Add(
"VehicleID"
);
DataRow row;
foreach
(Trip trip
in
clientTrips_scheduled)
{
row = scheduledTripsTable.NewRow();
row[
"ID"
] = trip.ID;
row[
"Title"
] = trip.Summary;
row[
"Start"
] =
trip.Start
;
row[
"End"
] =
trip.End
;
row[
"VehicleID"
] = trip.VehicleID;
scheduledTripsTable.Rows.Add(row);
}
tripScheduler.DataSource = scheduledTripsTable;
tripScheduler.DataBind();
The scheduler markup (although I am doing all of the work in code-behind, here's the markup so you can see what I'm doing):
<
telerik:RadScheduler
ID
=
"tripScheduler"
runat
=
"server"
DataKeyField
=
"ID"
DataSubjectField
=
"Title"
DataStartField
=
"Start"
DataEndField
=
"End"
DisplayDeleteConfirmation
=
"true"
onappointmentcreated
=
"tripScheduler_AppointmentCreated"
CustomAttributeNames
=
"VehicleID"
>
<
TimelineView
UserSelectable
=
"false"
/>
<
WeekView
UserSelectable
=
"false"
/>
<
MonthView
UserSelectable
=
"false"
/>
<
DayView
UserSelectable
=
"false"
/>
</
telerik:RadScheduler
>
Now I don't know what I'm doing wrong, I thought the foreign key field of "VehicleID" should allow appointments to be auto-assigned to their appropriate resources based on their "VehicleID" column value? Or do I need to do more than this?
Any help is greatly appreciated, sorry if I've missed something really obvious :)
The other problem is a very simple one - is it possible to assign separate start and end availability times for each resource? ie each Vehicle on my scheduler will have a shift start/end time, and I want this to be reflected on the scheduler.