This is a migrated thread and some comments may be shown as answers.

Telerik RadGrid Drag Drop Image

10 Answers 167 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 23 Nov 2011, 06:16 PM
Hi,

When dragging selected rows from a radgrid, obviously you can see the rows being dragged about - I'd like to change this behaviour for an image to appear 'docked' to the mouse and that be dragged about instead.

Can anyone point me in the right direction please?

Thanks a lot,

Dan

10 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 24 Nov 2011, 05:19 PM
Hello Daniel,

In order to achieve the desired look, you can access the dragged row and then modify it in the following way:
Copy Code
function rowDragging(sender, eventArgs) {
    var row = sender._draggedRow;
    //...
}
 
 
function GridCreated(sender, eventArgs) {
    sender.add_rowDragging(rowDragging);
}

I hope this helps.

Regards,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Daniel
Top achievements
Rank 1
answered on 02 Dec 2011, 03:18 PM
I don't really need to access the rows though, I need to change the image that is being dragged. Even if I were to save all of the ids of the rows, store them, and then remove all dragged rows so there was no image how would I then change the image being dragged from the grid?

Thanks a lot,

Dan
0
Mira
Telerik team
answered on 02 Dec 2011, 05:25 PM
Hello Daniel,

The following code demonstrated how to show an image when dragging:
Copy Code
function rowDragging(sender, eventArgs) {
    var row = sender._draggedRow;
    row.innerHTML = "<img src='imageURL' />";
}

Please give it a try and let me know whether this is the desired look.

Best wishes,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Daniel
Top achievements
Rank 1
answered on 05 Dec 2011, 10:03 AM
Hi,

Thanks again for your reply. I'm gettin the following error:

"Microsoft JScript runtime error: Object doesn't support property or method 'add_rowDragging'"

Caused by the following line:

sender.add_rowDragging(rowDragging);
0
Daniel
Top achievements
Rank 1
answered on 05 Dec 2011, 01:59 PM
Is it possible to achieve this server side maybe? To add the rowDragging event handler in c#?
0
Mira
Telerik team
answered on 06 Dec 2011, 01:22 PM
Hello Daniel,

You can register the script for handling the GridCreated event and attaching the rowDragging handler as it is described here.

I hope this helps.

Best wishes,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Daniel
Top achievements
Rank 1
answered on 07 Dec 2011, 03:18 PM
Mira how can I achieve this? I don't understand what you mean.

I have an 'OnGridCreated' function (client-side) wired up to the 'OnGridCreated' client event on the grid.

That is all I have so far.
0
Mira
Telerik team
answered on 14 Dec 2011, 09:21 AM
Hello Daniel,

Then, you can handle it in the following way in order to attach the rowDragging handler:
function GridCreated(sender, eventArgs) {
    sender.add_rowDragging(rowDragging);
}

To change the image, please use this code:
function rowDragging(sender, eventArgs) {
    var row = sender._draggedRow;
    row.innerHTML = "<img src='imageURL' />";
}

I hope this helps.

Best wishes,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Daniel
Top achievements
Rank 1
answered on 14 Dec 2011, 09:54 AM
 I'm gettin the following error:

"Microsoft JScript runtime error: Object doesn't support property or method 'add_rowDragging'"

Caused by the following line:

sender.add_rowDragging(rowDragging);
0
Mira
Telerik team
answered on 16 Dec 2011, 05:58 PM
Hello Daniel,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

I hope it helps.

Kind regards,
Mira
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Mira
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or