Selected Row different from Current row
Hi,
I have a GridDataBoundGrid with a GridFilterBar.
When I select the first row, the grid.Model.CurrentCellInfo.RowIndex is 2.
Then If I click on the drop down combobox filter''s button, the row selection is changed to the filter''s row.
The problem happens after selecting one row (for example the same first row), when I click inside one of the filters cell instead the drop down button, the select row continues to be the row I have selected before.
If I then click on ''none'', the grid.Model.CurrentCellInfo.RowIndex is 1, and not the index of the selected row.
I other words, clicking inside the combobox filter''s the selected row is not changed and CurrentCellInfo.RowIndex is !!
If then I get the selected row''s values, with:
grid.Model(grid.Model.CurrentCellInfo.RowIndex, 3).Text, the value is the one in the filter, and not the one in the select row.
How can I solve this problem, get value of the selected row ?
Thanks,
Jose Melo.
SIGN IN To post a reply.
3 Replies
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
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
JL Jose Luis Melo
- Mar 30, 2004 07:22 PM UTC
- Mar 31, 2004 01:37 PM UTC