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.

How do I know which record I''m formatting?

Thread ID:

Created:

Updated:

Platform:

Replies:

16364 Jul 13,2004 03:28 PM Jul 13,2004 04:21 PM Windows Forms 1
loading
Tags: Grouping
Daniel Chait
Asked On July 13, 2004 03:28 PM

I''m trying to handle the QueryCellStyleInfo event for my GridGroupingControl but I have trouble figuring out which row I''m being queried for. Here''s a code snippet: private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e) { if ( e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell ) { int a0 = e.Style.CellIdentity.CellPos.RowNumber; int a1 = e.Style.CellIdentity.RowIndex; int a2 = e.TableCellIdentity.CellPos.RowNumber; int a3 = e.TableCellIdentity.RowIndex; System.Diagnostics.Debug.WriteLine(String.Format("{0},{1},{2},{3}", a0,a1,a2,a3)); } } Unfortunately, for the first "real" row in my control, this shows me at row #4. How can I reliably compute which of my actual data records corresponds to what I''m looking at???

Administrator [Syncfusion]
Replied On July 13, 2004 04:21 PM

Hi Daniel, try the following code private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e) { if ( e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell ) { Table table = e.TableCellIdentity.DisplayElement.ParentTable; // Get record in table Record record = e.TableCellIdentity.DisplayElement.ParentRecord; int recordInTableIndex = table.Records.IndexOf(record); // - or in group - Group group = e.TableCellIdentity.DisplayElement.ParentGroup; int recordInGroupIndex = group.Records.IndexOf(record); } } Stefan

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.

;