Forum Discussion

tim_faron's avatar
tim_faron
Contributor
9 years ago

Get selected row index on a Telerik RadGridView

I have a RadGridView (Telerik.Windows.Controls.RadGridView) and i'm looking for a way in which I get the index of the selected row(s).

 

 

 

3 Replies

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi Tim,

     

    Try using:

     

    gridView.SelectedRows(ind).Index

    where ind ranges from 0 to gridView.SelectedRows.Count.

    • tim_faron's avatar
      tim_faron
      Contributor

      I tried the following but it didn't work, since there seems to be no SelectedRows property.

       

       

      //gridView.SelectedRows(ind).Index
      //where ind ranges from 0 to gridView.SelectedRows.Count.

       

      I also tried this code below, but SelectedItems does not have an index Property

      gridView.SelectedItems(ind).Index
      where ind ranges from 0 to gridView.SelectedItems.Count.

       

       

       

      • HKosova's avatar
        HKosova
        SmartBear Alumni (Retired)

        Hi Tim,

         

        The previous answer was for Telerik WinForms grid. If you use the WPF grid, try one of these:

         

        Single selection:

        SelectedRow.zparentIndex

         

        Multiple selection:
        SelectedCells.Regions.Item(index), then list all values from .Top to .Bottom. For example, if .Top = 3 and .Bottom = 5, then selected rows = 3, 4, 5.