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.
Unfortunately, activation email could not send to your email. Please try again.

ASP.NET MVC TreeGrid Copy Paste Content From Excel

Thread ID:

Created:

Updated:

Platform:

Replies:

130081 Apr 20,2017 04:19 AM Apr 21,2017 08:58 AM ASP.NET MVC 1
loading
Tags: TreeGrid
Martin R
Asked On April 20, 2017 04:19 AM

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.

Jayakumar Duraisamy [Syncfusion]
Replied On April 21, 2017 08:58 AM

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(/\n([^\n]*)$/, '$1').split('\n'); 
    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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;