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
close icon

ASP.NET MVC TreeGrid Copy Paste Content From Excel

Hi all,

I want to ask if there is possible to copy content of excel file and paste it into Web TreeGrid. This functionality is available in WPF Treegrid and we need to reimplement it into our web solution. 

This feature has high priority for us, can you please look at that?

Regards,
Martin Rasovsky.

1 Reply

JD Jayakumar Duraisamy Syncfusion Team April 21, 2017 12:58 PM UTC

Hi Martin, 
 
Thanks for contacting Syncfusion support. 
 
We have analyzed your requirement to paste rows in TreeGrid from Excel sheet, but currently we don’t have support for copy-paste functionality to adding the treegrid rows. But we can drag and drop the rows from excel to treegrid. It can be achieved in the work around and also prepared a MVC sample on this.  
Please find the code snippet below: 
@(Html.EJ().TreeGrid("TreeGridContainer"). 
//… 
    <script type="text/javascript"> 
    $("#TreeGridContainer").bind("drop", function (e) { 
    var treeObj = $("#TreeGridContainer").data("ejTreeGrid"); 
    var s = e; 
    var val = e.originalEvent.dataTransfer.getData("text"); 
    val = val.replace(/([^]*)$/, '$1').split(''); 
    for (var i = 0; i < val.length; i++) { 
    val[i] = val[i].replace(/\r/, "").split('\t'); 
    var taskItem = { "Id": val[i][0], "Name": val[i][1], "StartDate": val[i][2], "EndDate": val[i][3], "Duration": val[i][4], } 
    //To select the position for dragged Item 
    treeObj.addRow(taskItem, ej.TreeGrid.RowPosition.Below); 
    } 
    }); 
    $('#TreeGridContainer').bind('dragover', function (e) { 
    e.preventDefault(); 
    return false; 
    }); 
    </script> 
 
Please find the sample link location as below, 
 
Please let us know if you require further assistance on this. 
Regards, 
Jayakumar D 


Loader.
Live Chat Icon For mobile
Up arrow icon