GridDataBoundGrid in ListBoxSelectionMode One

I am using a GridBoundDataGrid with ListBoxSelectionMode = ONE. I would like to know how I can both get and set which row is selected in the grid.

Thanks

1 Reply

AD Administrator Syncfusion Team September 18, 2006 03:40 AM UTC

Hi Michael,

Use the Model.Selections property to manages selected ranges in the grid. It allows you to add and remove selections, determines selection state of a specific cell.

Issue 1: Set the selected rows..

this.grid1.Model.Selections.Add(GridRangeInfo.Row(RowIndex));

Issue 2: Get the selected rows..

//To find a selected rows in the grid
Console.WriteLine("Selected Ranges");
foreach( GridRangeInfo range in this.grid1.Model.Selections.Ranges)
{
Console.WriteLine(range.Info);
}

Thanks,
Haneef

Loader.
Up arrow icon