Tom Graham
Top achievements
Rank 1
Tom Graham
asked on 16 Mar 2010, 03:54 AM
I am using the sample Drag-n-Drop integration code and have added a resource table called "Rooms". Everything works ok until I try to drag an item from the RadGrid while the scheduler is grouped by the resources. I am am using SQLDataSources. I would assume that I need to retreive the resource id from the appointment area. Is there an example showing this functionality or could you point me in the right direction??
Thanks,
Tom
Thanks,
Tom
4 Answers, 1 is accepted
0
Hi Tom,
You can easily extend the Scheduler / Drag-and-drop demo to accommodate resource grouping. Provided that you configure your RadScheduler with resources, here is how you can modify the code from the demo:
Feel free to contact us if you need further assistance.
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
You can easily extend the Scheduler / Drag-and-drop demo to accommodate resource grouping. Provided that you configure your RadScheduler with resources, here is how you can modify the code from the demo:
private
void
HandleSchedulerDrop(
int
id,
string
subject,
string
targetSlotIndex)
{
RadScheduler1.Rebind();
ISchedulerTimeSlot slot = RadScheduler1.GetTimeSlotFromIndex(targetSlotIndex);
TimeSpan duration = TimeSpan.FromHours(1);
if
(slot.Duration == TimeSpan.FromDays(1))
{
duration = slot.Duration;
}
ScheduleAppointment(id, subject, slot.Start, slot.Start.Add(duration), slot.Resource);
}
//* * *
private
void
ScheduleAppointment(
int
id,
string
subject, DateTime start, DateTime end, Resource res)
{
Appointment appToInsert =
new
Appointment();
appToInsert.Subject = subject;
appToInsert.Start = start;
appToInsert.End = end;
appToInsert.Resources.Add(res);
RadScheduler1.InsertAppointment(appToInsert);
}
Feel free to contact us if you need further assistance.
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tom Graham
Top achievements
Rank 1
answered on 16 Mar 2010, 05:42 PM
Thanks for the quick reply. I still am getting this error "Resource index out of range: 1" when dropping a row onto the scheduler that is grouped by resources. Here is the code I am using. Not sure what I am missing. Putting a breakpoint in the code shows the slotTagetindex format going from " x.x.x " to " x.x.x.x " when scheduler is grouped by resources.
private void HandleSchedulerDrop(int id, string subject, string targetSlotIndex) |
{ |
RadScheduler1.Rebind(); |
ISchedulerTimeSlot slot = RadScheduler1.GetTimeSlotFromIndex(targetSlotIndex); |
TimeSpan duration = TimeSpan.FromHours(1); |
if (slot.Duration == TimeSpan.FromDays(1)) |
{ |
duration = slot.Duration; |
} |
ScheduleAppointment(id, subject, slot.Start, slot.Start.Add(duration), slot.Resource); |
} |
private void ScheduleAppointment(int id, string subject, DateTime start, DateTime end, Resource res) |
{ |
IDataSource dataSource = SqlDataSource1; |
DataSourceView view = dataSource.GetView("DefaultView"); |
IOrderedDictionary data = new OrderedDictionary(); |
data.Add("Subject", subject); |
data.Add("Start", start); |
data.Add("End", end); |
data.Add("employeeid", res); |
IDictionary keys = new OrderedDictionary(); |
keys.Add("AppointmentID", id); |
view.Update(keys, data, new OrderedDictionary(), OnDataSourceOperationComplete); |
} |
0
Tom Graham
Top achievements
Rank 1
answered on 16 Mar 2010, 06:28 PM
Putting a breakpoint in the code shows the slotTagetindex format going from " x:x:x " to " x:x:x:x " when scheduler is grouped by resources.
0
Hello Tom,
Please, try without calling Rebind()
Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Please, try without calling Rebind()
private
void
HandleSchedulerDrop(
int
id,
string
subject,
string
targetSlotIndex)
{
RadScheduler1.Rebind();
Greetings,
Peter
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.