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

GroupCaption Name

I have got a gridgroupingcontrol which is bound to a dataset (which contains multiple tables). Now when I display the grid I see for each group caption the name of the table. How can I change that name without influencing the real table names or the nested table names of the grid. I only want to change the displayed name? I tried it with the RelationDescriptor name but this has also influence on the NestedTable name of the grid. Cheers, Markus

4 Replies

AD Administrator Syncfusion Team September 6, 2005 08:12 AM UTC

Property-wise, you set these properties to control what is shown in the CaptionText. this.gridGroupingControl1.TopLevelGroupOptions.CaptionText = "x"; this.gridGroupingControl1.NestedTableGroupOptions.CaptionText = "x"; This gives you a chance to specify the caption content through a string containing specific tokens. If you cannot show what you want using this tokenized string property, then you can handle the TableControlDrawCellDisplayText event and there dynamically swap out some marker you put into th CaptionText property (or do whatever you need to do to display what you want).
private void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
{
	if(e.Inner.DisplayText == "x")
	{
		GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
		e.Inner.DisplayText = style.TableCellIdentity.Table.TableDescriptor.Name;;
	}
}


AD Administrator Syncfusion Team September 6, 2005 08:43 AM UTC

Thanks Clay that works!! Cheers, Markus


TC Titus Cheung October 6, 2007 02:18 PM UTC

Hello,

Sorry but I'm a bit lost here. Can someone please provide all the code required to do this? For example, I don't understand specifically the following:
1) Am I supposed to declare and code the class GridTableControlDrawCellDisplayTextEventArgs?
2) What is e.Inner.DisplayText? Like what does Inner mean?
3) What if I want to use the actual value in the cells of a specific column of a table instead of the table's name? What should I use?style.TableCellIdentity.Table.TableDescriptor.Column1.Cell.Value????

>Property-wise, you set these properties to control what is shown in the CaptionText.
>
>this.gridGroupingControl1.TopLevelGroupOptions.CaptionText = "x";
>this.gridGroupingControl1.NestedTableGroupOptions.CaptionText = "x";
>

>
>This gives you a chance to specify the caption content through a string containing specific tokens.
>
>If you cannot show what you want using this tokenized string property, then you can handle the TableControlDrawCellDisplayText event and there dynamically swap out some marker you put into th CaptionText property (or do whatever you need to do to display what you want).
>

>private void gridGroupingControl1_TableControlDrawCellDisplayText(object sender, GridTableControlDrawCellDisplayTextEventArgs e)
>{
> if(e.Inner.DisplayText == "x")
> {
> GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;
> e.Inner.DisplayText = style.TableCellIdentity.Table.TableDescriptor.Name;;
> }
>}
>


TC Titus Cheung October 6, 2007 02:54 PM UTC

Hello,

Never mind. Just found out that I can goto the Designer, select Properties, Table Descriptor, Grouped Columns and select the column that I want to group by.

I was loading data from a join SQL statement. Initially I used the foreign key which is an integer value to do the sorting.

Loader.
Live Chat Icon For mobile
Up arrow icon