---------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
///
/// Summary description for Export
/// public class Export
{
string attachment;
public Export()
{
}
public void Exportfn(GridView grdvw)
{
//Dataread drgrd = new Dataread();
//drgrd.fileread(sqlquery, grdvw);
attachment = "attachment; filename=AVAYA.xls";
System.Web.HttpContext.Current.Response.ClearContent();
System.Web.HttpContext.Current.Response.AddHeader("content-disposition", attachment);
System.Web.HttpContext.Current.Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
grdvw.RenderControl(htw);
System.Web.HttpContext.Current.Response.Write(sw.ToString());
System.Web.HttpContext.Current.Response.End();
}
}