public static void xlsport(GridView grd, string _fnm, Page p)
{
grd.Visible = true;
gridstrip(grd);
grd.DataBind();
HtmlForm form = new HtmlForm();
string attachment = "attachment; filename=" + _fnm + csclass.ranfn() + ".xls";
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.AddHeader("content-disposition", attachment);
HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
p.EnableViewState = false;
HttpContext.Current.Response.Charset = string.Empty;
System.IO.StringWriter stw = new System.IO.StringWriter();
HtmlTextWriter htextw = new HtmlTextWriter(stw);
form.Controls.Add(grd);
p.Controls.Add(form);
form.RenderControl(htextw);
HttpContext.Current.Response.Write(stw.ToString());
HttpContext.Current.Response.End();
}