why do i get my CurrentElement =null is ggc

hi all.
in the ggc_TableControlCellClick if the user clicked on the GroupCaptionCell, i try to get the 'Category' Value like this:
e.TableControl.Table.CurrentElement.ParentGroup.Category.ToString()
BUT - somethimes the CurrentElement is null.
why?

1 Reply

AD Administrator Syncfusion Team February 14, 2007 07:12 PM UTC

Hi Shankar,

You can use the below code snippet to get the group category name in a TableControlCellClick event.

private void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.Model[e.Inner.RowIndex,e.Inner.ColIndex] as GridTableCellStyleInfo;
if( style.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
GridCaptionRow row = style.TableCellIdentity.DisplayElement as GridCaptionRow;
if( row != null && row.ParentGroup != null )
Console.WriteLine( row.ParentGroup.Category );
}
}

Please refer to attached sample for more details.
ModifiedGGCCurrentCaptionColor.zip

Best regards,
Haneef

Loader.
Up arrow icon