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.
Syncfusion Feedback

Customize text in GroupCaptionCell

Thread ID:

Created:

Updated:

Platform:

Replies:

53186 Dec 10,2006 03:59 PM UTC Dec 12,2006 04:20 AM UTC Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On December 10, 2006 03:59 PM UTC

I have a ggc that has 1 level of grouping.
Assuming my the name of my group column name is 'ModelName', the ggc always display the text in the GroupCaptionCell as {GroupName}: {GroupNameText} - {} items

for example, if my current model group is 'Cars', the GroupCaptionCEll would show

ModelName: Cars - 23 items.

In my actual datasource, I also have the ModelID along with the ModelName. How do I add the ModelID as part of the ModelName in the GroupCaptionCell. The ModelID and ModelName will always have a 1 to 1 match.

Administrator [Syncfusion]
Replied On December 11, 2006 04:30 AM UTC

Hi James,

You can handle the QueryCellStyleInfo event to set the Style property of the GroupCaptionCell. See the below code snippet for more details.

private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if( e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell
&& e.TableCellIdentity.GroupedColumn != null &&
e.TableCellIdentity.GroupedColumn.Name == "Cars" )
{
e.Style.Text = "YourDisplayText Here";
}
}

Best Regards,
Haneef

James Blibo
Replied On December 11, 2006 04:46 PM UTC

I understand how to do that... I guess my issue is-> How do I get access to the records collection for this this GroupCaptionCell is the parent of?

Administrator [Syncfusion]
Replied On December 12, 2006 04:20 AM UTC

Hi James,

You can get the caption row from the displayelement and access the related records using the GridCaptionRow. Here is a code snippet to show this.

private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if( e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell
&& e.TableCellIdentity.GroupedColumn != null &&
e.TableCellIdentity.GroupedColumn.Name == "Cars" )
{
// get the CaptionRow from the DisplayElement.
GridCaptionRow gr = e.TableCellIdentity.DisplayElement as GridCaptionRow;

//Accessing the related records in a Group...
foreach(Record rec in gr.ParentGroup.Records)
{ Console.WriteLine("Records:" + rec); }
}
}

Best Regards,
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.

Warning Icon 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.Close Icon

;