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.

Group caption in cells

Thread ID:

Created:

Updated:

Platform:

Replies:

27070 Apr 6,2005 12:04 AM Jan 25,2007 06:00 AM Windows Forms 3
loading
Tags: Grouping
Rishi Tandon
Asked On April 6, 2005 12:04 AM

Hi, When we group by a certain column, we display the results,in form of a long string, as below. Field_A:Value_1 - 3 items Field_B=123 Field_C=12345 Field_A:Value_2 - 322 items Field_B=1234 Field_C=987 Is there a way to set these values in seperate cells in the grouped caption. The desired format is as below. {Field_A:Value_1 - 3 items}{Field_B=123}{Field_C=12345} {Field_A:Value_2 - 322 items}{Field_B=1234}{Field_C=987} {} denotes contents of individual cells on the group caption row. Thanks.

Administrator [Syncfusion]
Replied On April 6, 2005 06:49 AM

You can make the caption have cells by setting some properties to draw empty Caption Summary cells. Then you can provide the values for these cells in QueryCellStyleInfo. GridSummaryRowDescriptor summaryRow1 = new GridSummaryRowDescriptor(); summaryRow1.Name = "Caption"; summaryRow1.Visible = false; this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(summaryRow1); this.gridGroupingControl1.TopLevelGroupOptions.CaptionSummaryRow = "Caption"; this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
	if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell)
	{
		e.Style.Text = e.TableCellIdentity.ColIndex.ToString();
	}
}
Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GGC_ExcelCopy_335bd462.zip

Administrator [Syncfusion]
Replied On January 23, 2007 02:36 PM

Is ther a way to use this code:

GridCaptionRow gcr = e.TableCellIdentity.DisplayElement as GridCaptionRow;
GridCaptionSection gcs = gcr.ParentSection as GridCaptionSection;

string s = string.Empty; //.Format(e.TableCellIdentity.GroupedColumn.GetName());
// s += string.Format("nItems: {0}, ", gcs.ParentGroup.GetChildCount());

Record r = gcs.ParentGroup.GetFirstRecord();

r = gcs.ParentGroup.Records[1];

s += r.GetValue("Trading Dept") + ", "; //column name...

s += r.GetValue("Trading Group") + ", "; //column name...

e.Style.Text = s;

and have the cloumn data display in seperate columns?

If you use

e.Style.Text = e.TableCellIdentity.ColIndex.ToString();

the index show for the corrisponding column. Is this possible with the data as well?

Thanks
Hu Anderson

>You can make the caption have cells by setting some properties to draw empty Caption Summary cells. Then you can provide the values for these cells in QueryCellStyleInfo.
>
>GridSummaryRowDescriptor summaryRow1 = new GridSummaryRowDescriptor();
>summaryRow1.Name = "Caption";
>summaryRow1.Visible = false;
>this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(summaryRow1);
>this.gridGroupingControl1.TopLevelGroupOptions.CaptionSummaryRow = "Caption";
>this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo);
>

>
>

>private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
>{
> if(e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell)
> {
> e.Style.Text = e.TableCellIdentity.ColIndex.ToString();
> }
>}
>

>
>Here is a little sample.
>
>http://www.syncfusion.com/Support/user/uploads/GGC_ExcelCopy_335bd462.zip
>
>

Administrator [Syncfusion]
Replied On January 25, 2007 06:00 AM

Hi Anderson,

Thank you for being patience.

Please refer to the following sample which demonstrates the intend behavior. This can be achieved by handling the QueryCellStyleInfo event. In the event, the group category key is obtained and is drawn on the caption row. The following is the code snippet
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
// QueryCellStyleInfo event
if (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell)
{
GridCaptionRow gcr = e.TableCellIdentity.DisplayElement as GridCaptionRow;
GridCaptionSection gcs = gcr.ParentSection as GridCaptionSection;

Group grp = gcs.ParentGroup;
if (grp.IsTopLevelGroup)
return;

string value = captionSection.ParentGroup.Category.ToString();
e.Style.Text = value.ToString() ;
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Sample : Grouping_2005.zip

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

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.

;