I have a RadScheduler from Telerik in my project. There is a RadGrid beneath it on the same page. When I drag an appointment from the grid to the scheduler a different appointment appears on the scheduler.
Here is the RowDrop method of the grid:
protected void AppointmentRadGrid_RowDrop(object sender, GridDragDropEventArgs e)
{
GridDataItem dataItem = e.DraggedItems[0];
var values = new Hashtable();
dataItem.ExtractValues(values);
//long id = (long)dataItem.GetDataKeyValue("ID");
var subject = (string)values["Subject"];
long saNo = Int64.Parse(values["SANo"].ToString());
string targetSlotIndex = TargetSlotHiddenField.Value;
if (targetSlotIndex != string.Empty)
{
HandleSchedulerDrop(subject, targetSlotIndex, saNo);
TargetSlotHiddenField.Value = string.Empty;
}
//RadScheduler1.Rebind();
AppointmentRadGrid.Rebind();
CheckRadGridPanelVisible();
}
It seems that on this line:
dataItem.ExtractValues(values);
wrong values get extracted, which results in wrong appointments being set on the calendar.
Is this a bug in the RadScheduler or am I doing something wrong? Any help is appreciated.
Copy the entire code from the original Telerik demo and compare it with yours: http://demos.telerik.com/aspnet-ajax/scheduler/examples/draganddropintegration/defaultcs.aspx?product=grid.
Make sure to create the hash table in the grid's ItemCommand event.
Use the GetDataKeyValue() method if that returns correct data. You would only need to add the needed fields to the DataKeyNames collection.