using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

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

    }

    protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
    {
        using (NWDataContext nw = new NWDataContext())
        {
            RadGrid2.DataSource = nw.Customers.Take(15).ToList();
        }
    }

    protected void btnExportToExcel_Click(object sender, EventArgs e)
    {
        RadGrid2.ExportSettings.ExportOnlyData = true;
        RadGrid2.ExportSettings.IgnorePaging = true;
        RadGrid2.ExportSettings.OpenInNewWindow = true;

        RadGrid2.MasterTableView.ExportToExcel();
    }
}
