About Footer Total

I have 6 columns like bllow, when the datagrid to get the sum of the 6 columns, the datagrid generate 6 sqls to get the total number from database , this let the render speed so slow, can anyboady has a effictive way to get the the 6 columns sum tegerther.

       <FooterTemplate>
            Total amount: <b>@String.Format(new System.Globalization.CultureInfo("en-US"), "{0:C}", orders.Sum(o => o.Freight))</b>
        </FooterTemplate>

If you don’t want the queries to be executed from your database server you can use ToList() before assigning the IQueryable to the DataGrid Data property.