GridListControl get all selected rows

I want to be able to get all the selected rows from a gridlistcontrol. I cannot seem to find anyway of doing this. Can anyone help me?


1 Reply

NR Nirmal Raja Syncfusion Team October 23, 2008 03:11 PM UTC

Hi,

The GridListControl can be made muliselection using a property called SelectionMode property that has to be set as MultiExtended.
And using Grid.SelectionRanges we can get the range of selected rows from the GridListBox.

Please refer the below code snippet:
private void GridListBox1_SelectedValueChanged(object sender, EventArgs e)
{
if (GridListBox1.SelectedIndex != -1)
{
for (int i = GridListBox1.Grid.Model.SelectedRanges.ActiveRange.Top; i <= GridListBox1.Grid.Model.SelectedRanges.ActiveRange.Bottom; i++)
{
if (i != 0)
Console.WriteLine(GridListBox1.Items[i - 1].ToString());
}
}
}

Let me know if you have any queries.

Regards,
Nirmal



Loader.
Up arrow icon