We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Drag a tree node and drop into Gridview row index based

Hi,

Just i go through the Drag and Drop Manager on Shoping Cart Sample. The problem which i am facing is Drop the node into grid based on row index.

For Ex: Already I am dropped 3 nodes whiche means (3 rows) in Grid after that i am going to insert the 4th node in between
1st and 2nd row. So now 2nd row swap into rowindex 3 and inserted node goes to row index 2.

Let me know some samples related to drag a treenode and drop into dridview row index based?


Thanks,
Arun


1 Reply

ES Eswari S Syncfusion Team August 25, 2011 10:40 AM UTC

Hi Arun,

Thank you for your interest in Syncfusion products.

Query #1 : Drag a tree node and drop into Grid view row index based

We can achieve your requirement by using the rowIndex value of the dragged row.

Please refer to the following code snippets :

[JavaScript]

function DroppedTarget(grid, EventArgs) {
var records = EventArgs.data;
var params = {
CtrlKeyPressed: EventArgs.event.ctrlKey,
Id: grid.get_element().id,

RowIndex: $(EventArgs.event.originalEvent.target).parents("tr:first").attr("rowIndex") // rowIndex value passed to Dropped action
};


[Controller]

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Dropped(List Records, string Id, int RowIndex)
{
. . .
. . .
foreach (Order ord in Records)
{
NorthwindDataContext db = new NorthwindDataContext();
TempOrders.Insert(RowIndex, ord); // Record dragged with rowIndex value
}
. . ..
. . ..
}


For your convenience ,we have prepared the sample for your reference and same can be downloaded from the following link:

Sample-1254123216.zip

Please try this and let us know if you need any further assistance.

Regards,
Eswari.S




Loader.
Live Chat Icon For mobile
Up arrow icon