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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Can't add a expression field

Thread ID:





120181 Sep 8,2015 05:43 PM UTC Sep 22,2015 12:51 PM UTC WinForms 7
Tags: GridGroupingControl
Pierre Smith
Asked On September 8, 2015 05:43 PM UTC

I am trying to use the examples on the website to add an expression field but it isn't adding it when i run the code

here is the example
ExpressionFieldDescriptor exp1 = new ExpressionFieldDescriptor("Winning %", "([wins] *100)/([wins]+[ties]+[losses])", "System.Double");

ExpressionFieldDescriptor exp1 = new ExpressionFieldDescriptor("Loosing %", "([losses] *100)/([wins]+[ties]+[losses])", "System.Double");

//Adds expression fields to the grid table.

this.gridGroupingControl1.TableDescriptor.ExpressionFields.AddRange(new Syncfusion.Grouping.ExpressionFieldDescriptor[] { exp1, exp2 });

here is my code
ExpressionFieldDescriptor exp1 = new ExpressionFieldDescriptor("Totaal", "[Cost]*2", "System.Double");

can someone please tell me what i am doing wrong

Adhikesevan Kothandaraman [Syncfusion]
Replied On September 9, 2015 12:21 PM UTC

Hi Pierre,

Thank you for using Syncfusion Products.

In the ExpressionFieldDescriptor constructor, we need to pass the columns mapping name that we want to apply the Expression.

Code Example:

//Argument 1: Total is the mapping name of the column which we want to apply the Expression

//Argument 2: Expression like "[Column2] * 2 " Computation with other column values( here "Cost" is another Column name).

ExpressionFieldDescriptor exp1 = new ExpressionFieldDescriptor("Total", "[Cost]*2", "System.Double");

//Adding the expression field to the columns






Pierre Smith
Replied On September 9, 2015 02:25 PM UTC

the Cost field i have in my code is the mapping name not the column name

i will try your example and see if it works thank you

Adhikesevan Kothandaraman [Syncfusion]
Replied On September 10, 2015 06:11 AM UTC

Hi Pierre,

We look forward for your response.


Pierre Smith
Replied On September 10, 2015 08:50 AM UTC


So the problem is when i add my own names to the columns by using a columnset and then changing the visible columns then it becomes a problem where the expression field does not want to display. if i take all the columnset and visible columns away and just use it as a raw gridgroupingcontrol then the expression field works fine

so how do i impliment the expression field when i hide some of the columns and when i rename the columns to something different.

do i have to do it in a specific order ?

thank you

Venkatesh Sundaram [Syncfusion]
Replied On September 11, 2015 12:07 PM UTC

Hi Pierre,

Thanks for your interest in Syncfusion Product.

If the columns are hidden and change in the column name will not affect the expression fields. Since, the display text of the column name only changes, where the columns in the hidden state. The expression field are created using the mapping name. Please refer to the following sample for more reference. 

Sample Link:


Please let me know if you have any concern.


Pierre Smith
Replied On September 21, 2015 08:58 AM UTC

Just an update

The solution you gave me works but I had to figure out why my code is not working
What I discovered is that when I use a GridColumnDescriptorCollection to manually specify the names of my columns you need to add a unbounded column called Total for the expression field
I take it that you use the same name for the Column as what you use for the Expression field is this correct because it seems to work like that.

Adhikesevan Kothandaraman [Syncfusion]
Replied On September 22, 2015 12:51 PM UTC

Hi Pierre,

Thanks for your update.

While adding the expression fields to the TableDescriptor, it will check for the specific field present in the TableDescriptor.Column collection. If the field exist which will apply the expression to that field. Else, it will add a new Field with the expression name. Also, the field which is used for calculating the expression must be visible if you are using the unbound expression field.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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