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

Formatting Expression Columns display

I am using a groupinggridcontrol. and would like to display an expression column as a percentage display. Regular columns from my datasource I can set the format of the column using the following: MyGrid.TableDescriptor.Columns[5].Appearance.AnyCell.Format = "#0 %"; However this does not work for columns created using Expressionfields e.g. ExpressionFieldDescriptor avgTps = new ExpressionFieldDescriptor( "Average TPS", "[Total TPS] / [TPS Counter]" ); mSummaryGrid.TableDescriptor.ExpressionFields.Add( avgTps ); So how do I set the format attribute for this column

1 Reply

AD Administrator Syncfusion Team November 18, 2004 11:50 AM UTC

Try specifying the ResultType on the ExpressionFieldDescriptor. this.gridGroupingControl1.TableDescriptor.ExpressionFields.Add("sum"); ExpressionFieldDescriptor fd = this.gridGroupingControl1.TableDescriptor.ExpressionFields["sum"]; fd.ResultType = "System.Double"; fd.Expression = "[Col2] + [Col3]"; this.gridGroupingControl1.TableDescriptor.Columns["sum"].Appearance.AnyCell.Format = "#0.00 %";

Loader.
Live Chat Icon For mobile
Up arrow icon