protected void BindCompletedScheduleParameterGrid(int id) { try { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@OPR", "43"), new SqlParameter("@TestScheduleDetailId", id) }; DataTable Dt = new DataTable(); Dt = DBClass.GetDatatable_WithParam(param, "DM_SP_GET_DATA"); GrdCompletedScheduleStatus.DataSource = Dt; GrdCompletedScheduleStatus.DataBind(); } catch (Exception ex) { _logger.Error(string.Concat("BindCompletedGrid::", ex.Message), ex); } }
protected void btnExport_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename = SQC.xls"); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); if (Session["ScheduleTypeId"] != null && Convert.ToInt16(Session["ScheduleTypeId"].ToString()) != 3) { GrdCompletedScheduleStatus.AllowPaging = false; BindCompletedScheduleParameterGrid(Convert.ToInt16(Session["TestScheduleDetailId"].ToString())); GrdCompletedScheduleStatus.RenderControl(htmlWrite); } else { GrdSQCCompletedScheduleStatus.AllowPaging = false; BindSQCCompletedScheduleParameterGrid(Convert.ToInt16(Session["TestScheduleDetailId"].ToString())); GrdSQCCompletedScheduleStatus.RenderControl(htmlWrite); } Response.Write(stringWrite.ToString()); Response.End(); }