AD
Administrator
Syncfusion Team
March 30, 2004 10:41 PM UTC
Try
int rowIndex = this.grid.Binder.PositionToRowIndex(this.grid.Binder.CurrentPosition);
Does this give you the index that you want?
JL
Jose Luis Melo
March 31, 2004 01:09 PM UTC
Yes, it word perfectly... thanks...
But I still have one problem... if you could tell me one more thing...
I have two DataBoundGrids, and when I drag one line from grid1 to grid2, I catch the grid2.dragdrop event. If I drop the line inside the grid2 on the selected row, there is no problem... but if I drop it inside a not selected line, I would like to make that line selected in this event.
I can make the row selected with:
grid.ForceCurrentCellMoveTo = True
grid.CurrentCell.MoveTo(row, column)
, but how can I get the line the drop was made ?
Thanks again,
Jose Melo
AD
Administrator
Syncfusion Team
March 31, 2004 01:37 PM UTC
One comment on current row and selecting a row.
There is a distinction between being the current row, and a row being a selected row. In a gridDataboundGrid, being the current row means that the CurrencyManager.CurrentPosition (and grid.CurrentCell.RowIndex) point to this row. To select a row, you must add the row range to the grid.Selections collection. So, to select teh row at rowIndex, you woulduse code like:
grid.Selections.Add(GridRangeInfo.Row(rowIndex));
Normally, if you click on the row header it will make this row the current row, and also select it. If you click in some other cell, it nromally only makes the row the current row, and does not selection. (If you set the ListBoxSelectionMode property to something other than None, then clicking on any cell in teh row will also select that row).
In the drop event, you can get the current row under the cursor with code like:
Dim row, col As Integer
Dim pt As Point = Me.GridDataBoundGrid1.PointToClient(Control.MousePosition)
If Me.GridDataBoundGrid1.PointToRowCol(pt, row, col, -1) Then
'' row & col now have the values
End If