The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I'm have a single TreeViewAdv and need to allow or disallow a node being move based on the node being dragged and where it is being dropped. I "carry" the node type in the tag. The problem I'm having is that when I get the DragOver or DragDrop events I can't get the data from e.Data.GetData. I always get a null. I thought the object would be of type TreeNodeAdv but I get null back. I also tried object and a string with a conversion to see if I could get something but that didn't work either.
Any ideas?
Thanks
ADAdministrator Syncfusion Team August 14, 2003 06:08 PM UTC
You can use code given below to accomplish this.
private void treeViewAdv2_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
{
TreeNodeAdv[] tnas = e.Data.GetData(typeof(TreeNodeAdv[])) as TreeNodeAdv[];
}
The e.Data.GetData method here returns an array of TreeNodeAdv and not just a single TreeNodeAdv. This is done to take care of situations in which multiple nodes maybe dragged/dropped.
Let me know if this is the information you are looking for.
Regards,
Guru Patwal.
RIRickAugust 20, 2003 02:35 AM UTC
Guru Patwal,
That did it. Thanks!
CSChidd StoneMarch 2, 2007 03:32 PM UTC
Hi,
I tried using this line code in the DragOver event: nodesBeingDragged = e.Data.GetData(typeof(TreeNodeAdv[])) as TreeNodeAdv[];
but it returns null: Quick watch in VS2003 shows only one TreeNodeAdv in the data although I select multiple nodes. Have set property SelectionMode to MultiSelectSameLevel but have I forgotten something? (Syncfusion 4.4.0.51) Any help appreciated Chidd
MUMurugan Syncfusion Team March 2, 2007 09:33 PM UTC
Hi Chidd,
Herewith I have attached the sample for your requirement. Please refer to the sample and let me know if it helps you.
Hi, With TreeNodeAdv[] nodes = e.Item as TreeNodeAdv[]; in the treeViewAdv1_ItemDrag event I can get all treenodes if there is more than one. Thanks for your help Chidd
MUMurugan Syncfusion Team March 14, 2007 11:29 PM UTC
Hi Chidd,
I have tried the issue. But it is working fine here. Could you please send your sample? We will try to modify the sample and send you the resolved one.