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
{

    public void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        RadGrid1.ExportSettings.Pdf.PaperSize = GridPaperSize.Letter;
        RadGrid1.ExportSettings.Pdf.PageHeight = Unit.Parse("8.5in");
        RadGrid1.ExportSettings.Pdf.PageWidth = Unit.Parse("11in");
        (RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem)["ExpandColumn"].Visible =
            false;
        foreach (GridColumn column in RadGrid1.MasterTableView.RenderColumns)
        {
            if (column.UniqueName == "ContactName" || column.UniqueName == "CompanyName")
                column.HeaderStyle.Width = Unit.Pixel(120);
            else if (column.UniqueName == "ExpandColumn" || column.UniqueName == "RowIndicator")
            {
                column.Display = false;
                column.Visible = false;
                column.HeaderStyle.Width = Unit.Pixel(0);
            }
            else
                column.HeaderStyle.Width = Unit.Pixel(100);
        }

        foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items)
        {
            dataItem["ExpandColumn"].Text = "";
            dataItem["ExpandColumn"].Style["display"] = "none";
            dataItem["ExpandColumn"].Visible = false;
        }

        RadGrid1.MasterTableView.ExportToPdf();
    }
}


 