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. Image for the cookie policy date

GetNextCell in virtual grid

I'm having trouble using the GetNextCell in a virtual grid when selecting rows. It seems, no matter how many columns I actually have, GetNextCell keeps returning columns which don't exist. Is there something wrong with the following code? ArrayList rows = new ArrayList(); GridRangeInfoList selectedRows = this.gridControl1.Selections.GetSelectedRows(false, true); foreach (GridRangeInfo info in selectedRows ) { int top; int left; if ( info.GetFirstCell(out top, out left) ) { do { if ( !rows.Contains(top) ) { rows.Add(top); } } while( info.GetNextCell( ref top, ref left )); } } Thanks, Sue

1 Reply

AD Administrator Syncfusion Team October 6, 2003 10:08 PM UTC

The call to GetSelectedRows will return ranges of type GridRangeType.Row. The GetNextCell type works only with GridRangeType.Cell. What you should do is before the call to if ( info.GetFirstCell ... you should call info.ExpandRange(1, 1, RowCount, ColCount); This will convert the Row range into a Cell range that you can loop through. Stefan

Loader.
Live Chat Icon For mobile
Up arrow icon