Under Review
Last Updated: 10 Jun 2020 10:31 by ADMIN
Mario
Created on: 06 Jun 2020 15:51
Category: UI for WinForms
Type: Feature Request
0
CustomDragDropService Radtreeview

Hi everybody

 

I m try use the class CustomDragandDrop on radtreeview but i have a issue, 

if i use the next example, i dont have any problem:

      

   protected void BindRadTreeView()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Id", typeof(string));
            dt.Columns.Add("Title", typeof(string));
            dt.Columns.Add("ParentId", typeof(string));

            string parentId = string.Empty;
            string childId = string.Empty;
            for (int i = 0; i < 2; i++)
            {
                parentId = Guid.NewGuid().ToString();
                dt.Rows.Add(parentId, "Node" + i, null);
                for (int j = 0; j < 5; j++)
                {
                    childId = Guid.NewGuid().ToString();
                    dt.Rows.Add(childId, "SubNode" + i + "." + j, parentId);
                }
            }

            this.radTreeView1.ChildMember = "Id";
            this.radTreeView1.ParentMember = "ParentId";
            this.radTreeView1.DisplayMember = "Title";
            this.radTreeView1.DataSource = dt;


        }

 

i can drag and drop correctly

 

but the problem is when i binding the Radtreeview

 

                       

    protected void llenatreeview1() {

            dtTablas = dat.consultaBD();

            DataTable dt = new DataTable();
            dtCopi.Columns.Add("Id", typeof(string));
            dtCopi.Columns.Add("Title", typeof(string));
            dtCopi.Columns.Add("ParentId", typeof(string));

            string parentId = string.Empty;
            string Id = string.Empty;
            string title = string.Empty;
            foreach (DataRow row in dtTablas.Rows)
            {
                parentId = row["ParentId"].ToString();     

                Id = row["Id"].ToString();
                title = row["Title"].ToString();

                if (parentId == "")
                    dt.Rows.Add(Id, title, null);
                else
                    dt.Rows.Add(Id, title, parentId);
            }

            radTreeView2.ChildMember = "Id";
            radTreeView2.ParentMember = "ParentId";
            radTreeView2.DisplayMember = "Title";
            radTreeView2.DataSource = dt;
        }

first is freeze and then appears the error.

when i drag and drop appears then next error:

System.StackOverflowException

 

what am I doing wrong please your help. thanks
3 comments
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 10 Jun 2020 10:31
Hello, Mario, 

If you follow the same step by step example for achieving drag and drop functionality in RadTreeView, you are not expected to experience any undesired behavior. 

I have attached a sample project for your reference which result is illustrated in the attached gif file. Please give it a try and see how it works on your end. Am I missing something? Do you have a different setup in your project? Could you please specify the exact steps how to reproduce the problem? Feel free to modify the project in a way to reproduce the experienced issue and get back to me with it so I can investigate the precise case. Thank you in advance. 

I am looking forward to your reply.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Mario
Posted on: 08 Jun 2020 15:33

Hi again,Thank you for your prompt response.

 

for my example use the article you mention,

I do not understand why it fails when I use the information from my database.

ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 08 Jun 2020 04:46

Hello, Mario, 

RadTreeView handles the whole drag and drop operation by its TreeViewDragDropService. However, when the tree view control is in bound mode, due to the specificity of the RadTreeView’s data binding and the set up hierarchical data structure, it is necessary to handle manually the drag and drop operation to obtain correct nodes order. Please refer to the following help article which demonstrates a sample approach: https://docs.telerik.com/devtools/winforms/controls/treeview/drag-and-drop/drag-and-drop-in-bound-mode 

I would also recommend you to have a look at our Demo application >> TreeView >> Drag & Drop example.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.