Home Forums WinForms controls Xceed Grid for WinForms How to retrieve the selected row number ?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #13242 |

    Hello,

    I need to retrieve the row number of the select row, I made it with a “for” loop through the datarow but, isn’t there a simple why of retrieving it? Like “GetSelectedRow”? Because I think that using a loop for this is totaly non-sense. Imagine if I have thousands of rows in the grid and have to cycle them all everytime I select a new row.

    Tks for ur attention and possible help.

    Imported from legacy forums. Posted by EFileTahi-A (had 3705 views)

    User (Old forums)
    Member
    Post count: 23064

    If you are using a data-bound grid, and you need the rowindex that match the index in you’r data-collection, you can do this:

    int index = ((Xceed.Grid.DataRow)gridControl1.CurrentRow).Index;

    Regards
    Thomas

    Imported from legacy forums. Posted by C# (had 333 views)

    User (Old forums)
    Member
    Post count: 23064

    Remember there is only one currentRow.

    If you need all selected rows, you can do like this:
    Xceed.Grid.Collections.SelectedRowList list = gridControl1.SelectedRows;

    Regards
    Thomas

    Imported from legacy forums. Posted by C# (had 385 views)

    User (Old forums)
    Member
    Post count: 23064

    OMG!!! tks u very much!!! it works!!!

    Imported from legacy forums. Posted by EFileTahi-A (had 239 views)

    User (Old forums)
    Member
    Post count: 23064

    How can I retrieve the selected detaila grid row number and at the same time, get the row number of its mastter grid?

    Imported from legacy forums. Posted by peyton (had 4391 views)

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.