using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;

public partial class Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void MasterTableView_DataBinding(object sender, EventArgs e)
    {
        GridNumericColumn unitPriceCol = RadGrid1.MasterTableView.GetColumnSafe("Freight") as GridNumericColumn;
        GridBoundColumn idCol = RadGrid1.MasterTableView.GetColumnSafe("OrderID") as GridBoundColumn;

        unitPriceCol.FooterAggregateFormatString = "Total: {0:C} / Page Sum: ";
        idCol.FooterAggregateFormatString = idCol.Aggregate.ToString() + ": {0} Products";
    }
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridFooterItem)
        {
            double pageSum = 0;

            foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
            {
                pageSum += double.Parse(dataItem["Freight"].Text);
            }
            GridFooterItem footerItem = e.Item as GridFooterItem;
            footerItem["Freight"].Text = footerItem["Freight"].Text + string.Format("{0:C}", pageSum);
        }
    }
}
