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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback


Thread ID:





67554 Aug 23,2007 04:29 AM UTC Sep 11,2007 01:01 AM UTC WinForms 8
Tags: GridControl
Kent Boogaart
Asked On August 23, 2007 04:29 AM UTC


When filtering is applied, how can I correlate the ranges reported by GetSelectedRanges() back to my data?

Say I have three items in my data source: 'one', 'two', 'three'. Suppose the user uses the filter bar to filter out all but 'three'. If they select 'three' it is reported as a range of [1,1]. But what I really want is [3,3] so I can correlate to the actual data they've selected.

What facility is provided to translate this range to the equivalent range assuming no filtering?


Sarathi D [Syncfusion]
Replied On August 25, 2007 12:42 AM UTC

Hi ,

This is a default behavior of the filtering functionality in our grid. If you want to keep the index of the selected ranges in a grid then you need to follow the below steps to resolve this.

1) To disable default functionality of the filter bar in a grid.
2) Add an extra row header for a grid using Model.Rows.HeaderCount property.
3) Change the celltype of the extra header cell to Combox celltype and set its DataSource,DisplayMember and ValueMember property using the QueryCellInfo event.
4) Hide the non matching rows of the grid depending on the SelectedValue of the Extra header combox cell in CurrentCellCloseDropDown event of the grid using the SetRange method.

Please try this and let us know if you have any other questions regarding this issue. We will be glad to assist you.

Best regards,

Kent Boogaart
Replied On August 27, 2007 12:34 AM UTC

I'm confused. If there is no way to correlate selected ranges back to the data source, how is filtering even used in a real-world app?

All I want to do is something like:

_grid.DataSource = customers;

//later on
List selectedCustomers = new ...;

foreach (GridRangeInfo range in _grid.Selections)
//how do I get the Customer here?


Sarathi D [Syncfusion]
Replied On August 29, 2007 01:30 AM UTC


We currently looking into this issue. I will update the status of the issue within one business day.

Sorry for the inconvenience.


Kent Boogaart
Replied On August 29, 2007 02:08 AM UTC

Guess I'll answer my own question then for others struggling with the same problem.

Firstly, you might think you could use:


to translate the index to an index in the underlying data source. Indeed, that is exactly what this method is supposed to do. But it doesn't. No idea why.

To work around this, I access the DataView directly:

DataTable dataTable = _grid.DataSource as DataTable;
//i is just an index reported by a range from GetSelectedRanges()
int translatedIndex = _grid.Binder.RowIndexToPosition(i);
DataRow dataRow = dataTable.DefaultView[translatedIndex].Row;


Kent Boogaart
Replied On August 29, 2007 02:09 AM UTC

Sorry Sarathi,

I saw your reply after posting mine above. Let me know if you need more info.

Sarathi D [Syncfusion]
Replied On August 29, 2007 08:53 PM UTC

Hi Lcd,

Glad that you have solved the issue. Thank you for sharing the information with us.

Please let me know if you have any further queries.


Kent Boogaart
Replied On August 30, 2007 12:44 AM UTC

Hi Sarathi,

I'm interested to hear whether there are plans to fix RowIndexToListManagerPosition, or whether I'm just mistaken about its purpose. It seems to me it should facilitate exactly the functionality I was after, but doesn't.


Sarathi D [Syncfusion]
Replied On September 11, 2007 01:01 AM UTC

Hi Lcd,

Can you please create a direct trac incident in this regard since this is suspected to be a defect and we can discuss further on this issue.

Please specify the Forum Id in the subject line of the incident.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon