Saturday, January 18, 2014

Export to excel gridview content

private void ExportToExcel(string strFileName, GridView dg)
        {
            DataTable dt = GetData();
           
            dg.AllowPaging = false;
            dg.DataSource = dt;
            dg.DataBind();

            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment; filename=" + strFileName);
            Response.ContentType = "application/excel";
            System.IO.StringWriter sw = new System.IO.StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);
           
            dg.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();

        }

No comments:

Post a Comment

Image noise comparison methods

 1. using reference image technique     - peak_signal_noise_ratio (PSNR)     - SSI 2. non-reference image technique     - BRISQUE python pac...