0

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.

4
  • 1
    Does copying this demo over in its entirely work for you: demos.telerik.com/aspnet-ajax/scheduler/examples/…? Do you create the hash table in the grid ItemCommand event? Does the GetDataKeyValue() method return correct data? If so, you can use only that and add the needed fields to the DataKeyNames property of the table view.
    – rdmptn
    Apr 21, 2015 at 10:57
  • Thank you for your comment. It turned out PopulateScheduler(); in Page_Load was not wrapped in if(!IsPostBack){} Apr 21, 2015 at 14:51
  • so, it's OK now? If so, post this as an answer and accept it :) Or I could post that together with the demo link :)
    – rdmptn
    Apr 21, 2015 at 16:00
  • Yes, it's ok now. Please post an answer and I will accept it since your comment led me to the solution :-) Apr 22, 2015 at 10:16

1 Answer 1

1
  1. 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.

  2. Make sure to create the hash table in the grid's ItemCommand event.

  3. Use the GetDataKeyValue() method if that returns correct data. You would only need to add the needed fields to the DataKeyNames collection.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.