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. Image for the cookie policy date

grouping grid

in grouping grid column how do i chnage the format

currently it is showing

-Issuer: something - 2 Items

I want this to display as

-Something 2 Items




4 Replies

HA harshini October 8, 2010 08:00 PM UTC

grdDisplayItems.TableDescriptor.Columns[strColumnName].GroupByOptions.CaptionText = "{Category} {RecordCount} Items";

when i changed it to the above code..i dont see my changes it always display in this format

{CategoryCaption}: {Category} - {RecordCount} Items



NR Nirmal Raja Syncfusion Team October 13, 2010 01:15 PM UTC

Hi Harshini,

Thank you for your interest in Syncfusion products.

The Caption text of the GroupedCaption can be changed using the QueryCellStyleInfo, and the grouped value can be retrieved using the Category of the DisplayElement.

Please refer the code below to implement this behavior:
void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellType.GroupCaptionCell)
{
e.Style.Text = e.TableCellIdentity.DisplayElement.ParentGroup.Category.ToString();
}
}


Also refer the attached sample which showcases the behavior:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=CaptionText-2077938227.zip

Let me know if you have any queries.

Regards,
Nirmal



HA harshini October 13, 2010 02:38 PM UTC

thanks nirmal..

it works if we have to display category-no of items items text
example

bankname - 2 items

should we concatenate with

e.Style.Text = e.TableCellIdentity.DisplayElement.ParentGroup.Category.ToString();

as

e.style.Text += e.TableCellIdentity.DisplayElement.ParentGroup.GetRecordCount();

e.STYLE.tEXT += "Items";





RC Rajadurai C Syncfusion Team October 14, 2010 08:25 PM UTC

Hi Harshini,

Thanks for your update.

The effect of following code will be viewed only when that column is grouped.

this.gridGroupingControl1.TableDescriptor.Columns["Sport"].GroupByOptions.CaptionText = "{Category} {RecordCount} Items";


If you would like to set the caption format for the toplevelgroup(main group), the following setting have to be handled.

this.gridGroupingControl1.TopLevelGroupOptions.CaptionText = "{Category} {RecordCount} Items";


Similarly, for child groups,
this.gridGroupingControl1.ChildGroupOptions.CaptionText = "{Category} {RecordCount} Items";

and for nested tables,
this.gridGroupingControl1.NestedTableGroupOptions.CaptionText = "{Category} {RecordCount} Items";


Please let us know if you have any further concerns.

Regards,
Rajadurai


Loader.
Live Chat Icon For mobile
Up arrow icon