I have a grid with a column defined as follows:
<telerik:GridCalculatedColumn FilterControlAltText="Filter column1 column" UniqueName="YrPercent"
DataFields="Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,minTotal"
Expression="(({0} + {1} + {2} + {3} + {4} + {5} + {6} + {7} + {8} + {9} + {10} + {11}) / {12}) * 100.0"
Aggregate="Sum" HeaderText="Yr %" DataFormatString="{0:N3}%" FooterAggregateFormatString="{0:N3}%"
DataType="System.Double" FilterControlWidth="30px">
<FooterStyle HorizontalAlign="Right" />
<HeaderStyle Width="3.5%" HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Right" />
</telerik:GridCalculatedColumn>
As you can see, I'm looking for a percentage (in this case rather small ones, about .147 for example). All of the fields referenced in the calculation are integers. I've bound the grid with a call to a IQueryable method returning a call from LinqToSQL.
As is, this grid crashes with a Operator '*' incompatible with operand types 'Int32?' and 'Double' error. After much searching of your forums, I set the grid's EnableLinqExpressions property = false and everything seems to work.
2 questions.
<telerik:GridCalculatedColumn FilterControlAltText="Filter column1 column" UniqueName="YrPercent"
DataFields="Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec,minTotal"
Expression="(({0} + {1} + {2} + {3} + {4} + {5} + {6} + {7} + {8} + {9} + {10} + {11}) / {12}) * 100.0"
Aggregate="Sum" HeaderText="Yr %" DataFormatString="{0:N3}%" FooterAggregateFormatString="{0:N3}%"
DataType="System.Double" FilterControlWidth="30px">
<FooterStyle HorizontalAlign="Right" />
<HeaderStyle Width="3.5%" HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Right" />
</telerik:GridCalculatedColumn>
As you can see, I'm looking for a percentage (in this case rather small ones, about .147 for example). All of the fields referenced in the calculation are integers. I've bound the grid with a call to a IQueryable method returning a call from LinqToSQL.
As is, this grid crashes with a Operator '*' incompatible with operand types 'Int32?' and 'Double' error. After much searching of your forums, I set the grid's EnableLinqExpressions property = false and everything seems to work.
2 questions.
- Is there any way to get that expression to work without setting EnableLinqExpressions=false?
- What do I lose if I do set EnableLinqExpressions=false?