We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Selected Row different from Current row

Thread ID:

Created:

Updated:

Platform:

Replies:

12453 Mar 30,2004 07:22 PM UTC Mar 31,2004 01:37 PM UTC WinForms 3
loading
Tags: GridControl
Jose Luis Melo
Asked On March 30, 2004 07:22 PM UTC

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.

Administrator [Syncfusion]
Replied On 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?

Jose Luis Melo
Replied On 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

Administrator [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;