views:

336

answers:

1

Hello all,

After playing with the example code for the Telerik RadGrid drag and drop cabilities I'm at a loss at what to do next.

Here's what I'm wanting to do. I have one grid that has many rows populated, this is my source grid. I want to have four empty grids that are going to be used as targets for this populated source grid. Now I want to be able to drag a row from the source grid and be able to drop it on any one of the four target grids.

My question is this: Has anyone tried to do anything remotely like this? So far, all of the examples and threads that i've followed seem to have the one source to one target scenario. Any suggestions, examples or how to's would be greatly welcomed.

Thanks all for your time.

A: 

Well after looking through the actual methods of the Telerik grid I have found a way to determine where a dropped row will be going and how to work with that. I'm including the following simple code to demostrate what I'm talking about.

protected void uxSourceGrid_RowDrop(object sender, Telerik.Web.UI.GridDragDropEventArgs e)
{
    for (int i = 0; i < e.DraggedItems.Count; i++)
    {
        if (e.DestinationGrid.ID == uxRequiredDateGrid.ID)
        {
            SqlDataSource3.UpdateCommand = "UPDATE Orders SET RequiredDate = current_timestamp WHERE OrderID =" + e.DraggedItems[i].GetDataKeyValue("OrderID");
            SqlDataSource3.Update();
            uxRequiredDateGrid.Rebind();
        }
        else
        {
            SqlDataSource1.UpdateCommand = "update orders set shippeddate = current_timestamp where orderid =" + e.DraggedItems[i].GetDataKeyValue("OrderID");
            SqlDataSource1.Update();
            uxSourceGrid.Rebind();
        }
    }
}

The important part to look for is this little gem e.DestinationGrid.ID. From this you can find the ID's of the target grids and with a little logic be able to sort out what you're going to do with the dropping of a row. I'm sure that this can be a little cleaner or more effeciently. But I just wanted to pass this information along to you all in case you ever come up against this same type of scenario.

Chris