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 get the column name when on a summary row or caption row?

Thread ID:

Created:

Updated:

Platform:

Replies:

49413 Sep 18,2006 03:37 PM Sep 19,2006 01:24 AM Windows Forms 1
loading
Tags: Grouping
jamesb
Asked On September 18, 2006 03:37 PM

ow do I get the column name when on a summary row or caption row?

How do I get the column name of the current cell when the current cell is a summary row of a child table?

Administrator [Syncfusion]
Replied On September 19, 2006 01:24 AM

Hi James,

You can use code like:

GridCurrentCell cc = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);

switch(style.TableCellIdentity.DisplayElement.Kind )
{
case DisplayElementKind.Summary:
GridSummaryRow row = style.TableCellIdentity.DisplayElement as GridSummaryRow;
if( style.TableCellIdentity.SummaryColumn != null)
{
Console.WriteLine(style.TableCellIdentity.SummaryColumn.Name);
}
else /* Empty SummaryColumn*/
{
int index = row.ParentTableDescriptor.ColIndexToField(cc.ColIndex);
Console.WriteLine(row.ParentTableDescriptor.Columns[index].Name );
}
break;
case DisplayElementKind.Caption:
GridCaptionRow row1 = style.TableCellIdentity.DisplayElement as GridCaptionRow;
int index1 = row1.ParentTableDescriptor.ColIndexToField(cc.ColIndex);
Console.WriteLine(row1.ParentTableDescriptor.Columns[index1].Name );
break;
}

to get the information you wanted.

Thanks,
Haneef

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.

;