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

public partial class _Default : System.Web.UI.Page
{
    bool isPdfExport = false; 
    
    protected void Button1_Click(object sender, EventArgs e)
    {
        isPdfExport = true;
        RadGrid1.MasterTableView.Rebind();        
        RadGrid1.MasterTableView.ExportToPdf();
    }
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {

        if (isPdfExport && e.Item is GridHeaderItem)
        {
            GridHeaderItem headerItem = (GridHeaderItem)e.Item;            
            headerItem.Style["font-family"] = "Courier";
            headerItem.Style["font-size"] = "16pt";
            headerItem.Style["color"] = "red";
            headerItem.Style["background-color"] = "yellow";
            headerItem.Style["height"] = "50px";
            headerItem.Style["vertical-align"] = "bottom";
            foreach (TableCell cell in headerItem.Cells)
            {
                cell.Style["font-family"] = "Courier";
                cell.Style["text-align"] = "left";
                cell.Style["font-weight"] = "bold";
                cell.Style["border-color"] = "red";
            }
        } 
    }
}
