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

Set Group By Header to show Combo Text not Value

In a Data Bound Grouping Grid Control, if a user groups by a column that has a drop down list, the item displayed in the header of each group is the VALUE not the TEXT of the list items

Example: In a column named TreeTypes with combo boxes may have values:
Oak (1)
Pine (2)
Other (3)

If the user groups by that column, the Header will display something like:

Tree Types: 1 -- 2 items

That's not helpful for the user at-all... they don't know or care what the value for Oak (i.e,. 1) is...

What I want it to display is:
Tree Types: Oak -- 2 items





5 Replies

MC Mercy C Syncfusion Team March 28, 2012 01:06 PM UTC

Hi Eric,

Thanks for your interest in Syncfusion products.

you can set the Group caption text, using "CaptionText" property.

this.gridGroupingControl1.ChildGroupOptions.CaptionText = "Total Records for {CategoryCaption}:{Category} is {RecordCount}";

Please refer to the sample in the following link
http://www.syncfusion.com/downloads/Support/DirectTrac/92661/WindowsFormsApplication73-96986498.zip

Regards,
Mercy.C



ER Eric Robishaw March 28, 2012 04:04 PM UTC

Unfortunately, none of the customizable {} fields allow for the TEXT of the grouped by column, it still only shows the underlying VALUE.

See The attached. I modified your example to show the problem.

It now groups by "Department" instead of "Average". I set the Department column to be type ComboBox.

I want the GroupBy Header to Say something like:
"Grouped By Department 'Civil', Showing 6 Records"

Apparently there is no custom field {CategoryText} which is what I need.

I can't even seem to find a way to do this in the QueryCellStyleInfo event.








WindowsFormsApplication73 Group By Dept_108d5652.zip


MC Mercy C Syncfusion Team April 5, 2012 10:39 AM UTC

Hi Eric,

Thanks for your interest in Syncfusion products.

You cannot directly set the caption text as required. To achieve your requirement, please set as "text" in the data table instead of "value".

dr[2] = deptNVP[rand.Next(deptNVP.Length-1)].Text;

Please refer to the sample in the following link

http://www.syncfusion.com/downloads/Support/DirectTrac/92937/WindowsFormsApplication73-1516279487.zip

please let me know if you have any concerns.

Regards,
Mercy.C




ER Eric Robishaw April 6, 2012 04:21 PM UTC

Setting the field's value to the Text Value is NOT how relational databases work... and I'm actually displaying data from a DataTable (the example provided was a simplified way to show the problem, not a real world example).

Alas, I HAVE A WORKING SOLUTION

Create a custom IGroupByColumnCategorizer class ...
During the GroupedColumns_Changing event, set the column descriptor's Categorizer and Comparer to an instance of this class.

And viola....

SEE ATTACHED







WindowsFormsApplication73_f1976044.zip


RB Ragamathulla B Syncfusion Team April 9, 2012 01:18 PM UTC

Hi Eric,

Thanks for the update.

We are glad to hear the issue has been resolved. Let me know if you have any further concerns.

Regards,
Ragamathullah B.


Loader.
Live Chat Icon For mobile
Up arrow icon