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

Darg and Drop with Grouping Part 2

1 Answer 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Adrien
Top achievements
Rank 1
Adrien asked on 16 Apr 2008, 10:25 PM
When attempting to drag an item from a grouped gridview I run into the following issue.

On the MouseDown event I am trying to get the row under the mouse. The GetElementAtPoint is returning an index to a row which is outside the range of GridView.Rows. How do I get the row that was selected???????

1 Answer, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 17 Apr 2008, 03:04 PM
Hello Adrien,

Thank you for getting back to us.

To get the row element at the returned index, please use the GetVisibleRow method of the GridViewInfo.

Consider the following code snippet:

void radGridView1_CellMouseMove(object sender, MouseEventArgs e) 
{     
    GridCellElement cell = (GridCellElement)sender; 
    GridViewRowInfo rowInfo = this.radGridView1.MasterGridViewInfo.GetVisibleRow(cell.RowIndex); 
    //... 
 

You need to do this, because when the grid is grouped, the Rows collection contains only the rows at the first grouping level (e.g. the group header rows). You should use the Rows collection of the GridViewRowInfo to get the rows at the second level.

We have just released the Q1 2008 version of RadControls for WinForms. In this release we changed the described behavior. Now the Rows collection contains only the data rows in a flat view. You can get the group rows through the RootGroups property of the GridViewInfo class.

We encourage you to download the new release and share with us your experience. The Q1 2008 is available for download from your Client.net account.

Let me know, if you need further assistance.

Kind regards,
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
Jack
Telerik team
Share this question
or