Row header to display line numbers

Hi,
I am using Grid Groupping Control. How can I change the row header to display line numbers instead of the black triangle?



Please resolve the problem ASAP.


Regards
Tannearu Gupta

1 Reply

AD Administrator Syncfusion Team November 30, 2006 10:07 AM UTC

Hi Tannearu,

To display the record number on the RowHeader of the grouping grid, you need to handle the QueryCellStyleInfo Event. The code below will help you to accomplish your task. Please refer to the Sample attached for implementation.

this.gridGroupingControl1.TableControl.TableDescriptor.Appearance.RowHeaderCell.CellType = "Header";
this.gridGroupingControl1.TableOptions.RowHeaderWidth = 35;

//Subscribe the QueryCellStyleInfo event.
this.gridGroupingControl1.QueryCellStyleInfo +=new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);

private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if( e.Style.CellType == "Header" )
{
Element el = e.TableCellIdentity.DisplayElement;
if( el.Kind == DisplayElementKind.Record)
{
GridRecordRow recRow = el as GridRecordRow;
if( recRow.ParentRecord != null)
{
int iRecordIndex = el.ParentTable.UnsortedRecords.IndexOf(recRow.ParentRecord);
e.Style.Text = (iRecordIndex + 1).ToString() ;
}
}
}
}

Here is a modified sample.
GGCNumberedRowHeader.zip

Best Regards,
Haneef

Loader.
Up arrow icon