This is a migrated thread and some comments may be shown as answers.

Drag And Drop with Grouping

6 Answers 150 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adrien
Top achievements
Rank 1
Adrien asked on 15 Apr 2008, 05:22 PM
I am trying to drag items from one RadGridView control to a second. I can get the item ID when I do the drop but I cannot get the group ID that I am trying to drop on. GetClientAtPoint and GetElementAtPoint bothe return null.

6 Answers, 1 is accepted

Sort by
0
Adrien
Top achievements
Rank 1
answered on 15 Apr 2008, 08:07 PM
After reading another post, I was able to get an object using the PointToClient function. But I am still stymed while trying to get the Data used to build the group header. Specifically the ID field from the header.
0
Accepted
Jack
Telerik team
answered on 16 Apr 2008, 08:33 AM
Hello Adrien,

Thank you for contacting us.

You should get the GridCellElement that is under the mouse pointer. From this element, you can get information about the row and the other cells.

You could use code similar to the one below:

void radGridView1_DragDrop(object sender, DragEventArgs e) 
    Point location = this.radGridView1.PointToClient(new Point(e.X, e.Y)); 
    RadElement element = this.radGridView1.GetElementAtPoint(location); 
    GridCellElement cell = element as GridCellElement; 
    if (cell != null
    { 
        if (cell.RowInfo is GridViewHeaderRowInfo) 
        { 
            string text = ((GridViewHeaderRowInfo)cell.RowInfo).Text; 
        } 
        else 
        { 
            int ID = (int)cell.RowInfo.Cells["ID"].Value; 
        } 
    } 

I hope this helps. Do not hesitate to write me, if you have other questions.

Regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Adrien
Top achievements
Rank 1
answered on 16 Apr 2008, 04:43 PM
It would be nicer if I could get the ID when the user drops on the header but the display text allows me to get the ID based off the other information I have available.
0
Jack
Telerik team
answered on 17 Apr 2008, 02:27 PM
Hello Adrien,

You can get the row index by using the RowIndex property of the GridCellElement. Could you describe in more details what what is the exact functionality you expect.

We will consider implementing it in one of our upcoming releases.

Please, let me know if I can help you further.

All the best,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Adrien
Top achievements
Rank 1
answered on 17 Apr 2008, 04:33 PM
In your example above you have different information returning based on whether it is a Group Header or a Data row under the mouse. I would think that when you clicked on the GroupHeader you would easily be able to get the Value of the field you are grouping on (in my case and ID field while displaying a text string for user readability)
0
Jack
Telerik team
answered on 18 Apr 2008, 09:22 AM
Hi Adrien,

Thank you for this suggestion. You are right, it will be nice to have such functionality. We will consider implementing this feature for our upcoming release.

Let me know, if I can help you further.

Best wishes,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Adrien
Top achievements
Rank 1
Answers by
Adrien
Top achievements
Rank 1
Jack
Telerik team
Share this question
or