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. Image for the cookie policy date

GridGroupingControl.TableModel.Options.NumberedRowHeaders

When I set gridGroupingControl1.TableModel.Options.NumberedRowHeaders = true; I expected that instead of the little triangle thingy on the current record I would see row numbers there... like Excel... but it doesn''t work.

2 Replies

AD Administrator Syncfusion Team July 22, 2004 10:03 AM

Daniel, The GridTableRowHeaderCellRenderer (RowHeaderCell celltype) ignores this setting since it does not make sense to display the underlying row index in most cases. Row 1 will be the column headers and records would be offset. What is better is if you display the record index instead. You can do this by handling the TableControlPrepareViewStyleInfo event and specify "Header" as cell type. this.groupingGrid1.TableControlPrepareViewStyleInfo += new GridTableControlPrepareViewStyleInfoEventHandler(groupingGrid1_TableControlPrepareViewStyleInfo); private void groupingGrid1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e) { GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style; if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordRowHeaderCell || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordRowHeaderCell) { Record r = style.TableCellIdentity.DisplayElement.ParentRecord; int recordIndex = r.ParentTable.Records.IndexOf(r); string displayText = recordIndex.ToString(); e.Inner.Style.CellValue = displayText; e.Inner.Style.CellType = "Header"; } } Stefan


DC Daniel Chait July 22, 2004 10:14 AM

Thanks... what''s the difference between groupingGrid1.TableControlPrepareViewStyleInfo and gridGroupingControl1.QueryCellStyleInfo They seem like they accomplish similar things, no? If I already have code in QueryCellStyleInfo will it clobber the other? >Daniel, > >The GridTableRowHeaderCellRenderer (RowHeaderCell celltype) ignores this setting since it does not make sense to display the underlying row index in most cases. Row 1 will be the column headers and records would be offset. > >What is better is if you display the record index instead. You can do this by handling the TableControlPrepareViewStyleInfo event and specify "Header" as cell type. > > >this.groupingGrid1.TableControlPrepareViewStyleInfo += new GridTableControlPrepareViewStyleInfoEventHandler(groupingGrid1_TableControlPrepareViewStyleInfo); > >private void groupingGrid1_TableControlPrepareViewStyleInfo(object sender, GridTableControlPrepareViewStyleInfoEventArgs e) >{ > GridTableCellStyleInfo style = (GridTableCellStyleInfo) e.Inner.Style; > if (style.TableCellIdentity.TableCellType == GridTableCellType.RecordRowHeaderCell > || style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordRowHeaderCell) > { > Record r = style.TableCellIdentity.DisplayElement.ParentRecord; > int recordIndex = r.ParentTable.Records.IndexOf(r); > > string displayText = recordIndex.ToString(); > > e.Inner.Style.CellValue = displayText; > e.Inner.Style.CellType = "Header"; > } >} > > > >Stefan >

Loader.
Live Chat Icon For mobile
Up arrow icon