Example #1
0
 protected void btnExport_Click(object sender, EventArgs e)
 {
     Response.Clear();
     Response.AddHeader("content-disposition", "attachment;filename = QC_Parameter.xls");
     Response.ContentType = "application/vnd.xls";
     System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
     System.Web.UI.HtmlTextWriter htmlWrite   =
         new HtmlTextWriter(stringWrite);
     GrdParameterList.AllowPaging = false;
     GetData();
     GrdParameterList.RenderControl(htmlWrite);
     Response.Write(stringWrite.ToString());
     Response.End();
 }
Example #2
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            Response.Clear();
            Response.AddHeader("content-disposition", "attachment;filename = QC_Parameter.xls");
            Response.ContentType = "application/vnd.xls";
            System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite   =
                new HtmlTextWriter(stringWrite);
            GrdParameterList.AllowPaging = false;
            GetData();
            foreach (GridViewRow row in GrdParameterList.Rows)
            {
                (GrdParameterList.Rows[row.RowIndex].Cells[0].FindControl("lnkParameterName") as LinkButton).Enabled = false;
            }

            GrdParameterList.RenderControl(htmlWrite);
            Response.Write(stringWrite.ToString());
            Response.End();
        }