How to get Selected Rows in Griddataboundgrid in Windows Forms GridDataBoundGrid(Classic)
9 Dec 2019 / 1 minute to read
To get the selected row use GetSelectedRows method. It returns GridRangeInfoList object, an array of GridRangeInfo objects. This method has two arguments,
- bRangeRowsOnly
True - Only selected row will be returned,
False - If you want to treat single range selection as a full row selection.
- ConsiderCurrentCell
True - If current cell should be returned as selected range.
GridRangeInfoList ranges = this .gridDataBoundGrid1 .Selections. GetSelectedRows(true, false);
foreach (GridRangeInfo range in ranges)
{
for (int i = range.Top; i <= range.Bottom; ++i)
{
Console.WriteLine(string.Format("Row {0} selected", i));
}
}
Dim ranges As GridRangeInfoList = Me.gridDataBoundGrid1 .Selections. GetSelectedRows(True, False)
For Each range As GridRangeInfo In ranges
For i As Integer = range.Top To range.Bottom
Console.WriteLine(String.Format("Row {0} selected", i)) Next i
Next range
Was this page helpful?
Yes
No
Thank you for your feedback!
Thank you for your feedback and comments. We will rectify this as soon as possible!
An unknown error has occurred. Please try again.
Help us improve this page