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

How to get datasource's index in QueryCellStyleInfo?

Thread ID:





106916 Jan 31,2013 06:03 PM UTC Feb 5,2013 12:09 PM UTC WinForms 1
Tags: Grouping
Administrator [Syncfusion]
Asked On January 31, 2013 06:03 PM UTC

I have a main table "MainTable" and a nested named "NestedTable", something like this:

+ Group 1 (3)
    -- Item A1
    -- Item A2
    -- Item A3
+ Group 2 (1)
    -- Item B1

All groups "Group X" are in a BindingList named groups.
All items "Item XX" are in a BindingList named items.

Within QueryCellStyleInfo I can identify the record being filled is "Item B1", but how can I get the actual object that represents this record "Item B1"?

I can't use e.TableCellIdentity.RowIndex because it represents the index inside the nested table, in this case "Item A1" would be 0, but my items[0] is "Item A1". I need to get items[3].

How can I do this programmatically?

Vinish Kumar K [Syncfusion]
Replied On February 5, 2013 12:09 PM UTC

Hi Cristiano,


Thank you for your interest in Syncfusion Products.


We have analyzed your sample to get the record info. The queryCellInfo event refer multiple time in GridGroupingControl. But you can get the record info using the CurrentCelllClick event in GGC. The following workaround is used to get the record info in GGC.


Normally in GGC the caption and group drop area also included in row index. So we can’t able to get the record based on the e.Inner.RowIndex.  Because it refers the another records. If we want to get the selected records by passing the index means you could pass the record index based on the following code. Please refer the following code.


void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)


GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);

GridTableCellStyleInfoIdentity id = style.CellIdentity as GridTableCellStyleInfoIdentity;

Element el = style.TableCellIdentity.DisplayElement;

GridCaptionRow gridCaptionRow = el as GridCaptionRow;

if (gridCaptionRow != null)


Record rec = gridCaptionRow.GetCaptionSection().ParentGroup.Records[0];




int index = this.gridGroupingControl1.Table.Records[0].GetRowIndex();

int selectedRecIndex = e.Inner.RowIndex - index;

Record rec1 = this.gridGroupingControl1.Table.Records[selectedRecIndex];

// Get the record of first current selected records if groups are collapsed.

//Record rec = this.gridGroupingControl1.Table.CurrentRecord;



Please refer the attached sample file also for your further reference. If you have any issue in this code. Please modify the attached sample and please provide the steps to reproduce the issue.



Please let me know if you have any other concerns.


Vinish Kumar.


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