I'm doing some testing with the RadGrid CalculatedColumn. It's a timesheet application so I'd like to use the GridCalculatedColumn to total the hours for the week (row) and sum aggregate to total the hours for the day (column). Some days won't have hours so the datafield will pull in NULL. The sum aggregates are working fine but the GridCalculatedColumn is not displaying a value.
Here is the code for my columns:
In one row example, there are hours in only Monday and Tuesday. If I changed the DataFields to "Hours_Mon, Hours_Tue" and the Expression to "{0}+{1}" then the CalculatedColumn works correctly. Am I only allowed to do a calculation on 2 data fields or is it running into a problem with the null values for the rest of the days? Am I missing a property in my columns?
Here is the code for my columns:
<rad:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataField="Hours_Sun" DataType="System.Decimal" HeaderText="SUN" /> |
<rad:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataField="Hours_Mon" DataType="System.Decimal" HeaderText="MON" /> |
<rad:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataField="Hours_Tue" DataType="System.Decimal" HeaderText="TUE" /> |
<rad:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataField="Hours_Wed" DataType="System.Decimal" HeaderText="WED" /> |
<rad:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataField="Hours_Thu" DataType="System.Decimal" HeaderText="THU" /> |
<rad:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataField="Hours_Fri" DataType="System.Decimal" HeaderText="FRI" /> |
<rad:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataField="Hours_Sat" DataType="System.Decimal" HeaderText="SAT" /> |
<rad:GridCalculatedColumn Aggregate="Sum" FooterAggregateFormatString="{0:F}" DataFormatString="{0:F}" DataFields="Hours_Sun, Hours_Mon, Hours_Tue, Hours_Wed, Hours_Thu, Hours_Fri, Hours_Sat" Expression="{0}+{1}+{2}+{3}+{4}+{5}+{6}" DataType="System.Decimal" HeaderText="WEEK TOTAL" /> |
In one row example, there are hours in only Monday and Tuesday. If I changed the DataFields to "Hours_Mon, Hours_Tue" and the Expression to "{0}+{1}" then the CalculatedColumn works correctly. Am I only allowed to do a calculation on 2 data fields or is it running into a problem with the null values for the rest of the days? Am I missing a property in my columns?