Category / Section
How to have an Expression field in GridGroupingControl?
1 min read
The Expression fields can be created by using the ExpressionFieldDescriptor class. The ExpressionFieldDescriptor allows to have a field that holds an algebraic expression using the other fields of the Grid. Please refer the below code snippet which illustrates this:
C#
this.GridGroupingControl1.TableDescriptor.ExpressionFields.Add(new ExpressionFieldDescriptor("NewCategoryID", "[CategoryID] * 4", typeof(int)));
VB
Me.GridGroupingControl1.TableDescriptor.ExpressionFields.Add(New ExpressionFieldDescriptor("NewCategoryID", "[CategoryID] * 4", GetType(Integer)))
The above snippet creates the new field named as "NewCategoryID" which has it's value 4 times as the field CategoryID".