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.
Unfortunately, activation email could not send to your email. Please try again.

GridListControl get all selected rows

Thread ID:

Created:

Updated:

Platform:

Replies:

77252 Oct 22,2008 02:10 PM Oct 23,2008 11:11 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On October 22, 2008 02:10 PM

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?


Nirmal Raja [Syncfusion]
Replied On October 23, 2008 11:11 AM

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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;