columnheader text of a selected cell

Hello,

Please suggest how i could get the column header text of a selected cell. For now I am doing the below but it seems the same is not valid for grouped rows

int colIndex = gridGroupingControl.TableControl.CurrentCell.Renderer.CurrentCell.ColIndex - 1;
String headerText = gridGroupingControl.TableDescriptor.Columns[colIndex].HeaderText;

Thanks


1 Reply

FS Fathima Shalini P Syncfusion Team January 28, 2008 09:22 AM UTC

Hi John,

Thank you for your interest in Syncfusion Products.

The header text of the selected cell can be retrieved using TableControlCellClick event of the GridGrouping Control, even when the control is grouped.


void gridGroupingControl1_TableControlCellClick(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCellClickEventArgs e)
{
int field = e.TableControl.TableDescriptor.ColIndexToField(e.Inner.ColIndex);
Console.WriteLine(e.TableControl.TableDescriptor.Columns[field].HeaderText);
}


Please have a look at the following sample that illustrates this:

http://websamples.syncfusion.com/samples/Grouping.Windows/F71297/main.htm

Please let me know if any concerns.

Regards,
Fathima


Loader.
Up arrow icon