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_Init(object sender, EventArgs e)
    {
    }

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (isExport)
        {
            if (e.Item is GridHeaderItem)
            {
                e.Item.Style["background-color"] = "#999999";
                foreach (TableCell cell in e.Item.Cells)
                {
                    cell.Style["font-family"] = "Arial Narrow";
                    cell.Style["font-size"] = "10px";
                }
            }
            if (e.Item is GridDataItem)
            {
                e.Item.Style["background-color"] = "#dddddd";
                foreach (TableCell cell in e.Item.Cells)
                {
                    cell.Style["font-family"] = "Arial Narrow";
                    cell.Style["font-size"] = "10px";
                }
            }

        }
    }

    bool isExport;
    protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
    {
        if (e.CommandName == "ExportToPdf")
        {
            foreach (GridColumn col in RadGrid1.MasterTableView.Columns)
            {
                col.HeaderStyle.Width = Unit.Pixel(52);
            }
            isExport = true;
        }
    }
}
