protected void ImgBtnExport_Click(object sender, ImageClickEventArgs e) { string fileName = "RequirementList-Flowndown.xls"; const string m_Http_Attachment = "attachment;filename="; const string m_Http_Content = "content-disposition"; Response.ClearContent(); Response.AddHeader(m_Http_Content, m_Http_Attachment + fileName); Response.ContentType = "application/excel"; StringWriter m_StringWriter = new StringWriter(); HtmlTextWriter m_HtmlWriter = new HtmlTextWriter(m_StringWriter); GVReq.AllowPaging = false; GVReq.HeaderStyle.Font.Bold = true; GVReq.AllowSorting = false; BindGrid(); GVReq.RenderControl(m_HtmlWriter); string m_gridViewText = m_StringWriter.ToString(); string style = @"<style> .textmode { mso-number-format:\@; } </style>"; Response.Write(style); Response.Write(m_gridViewText); Response.Flush(); Response.End(); }
protected void FillReqDetails(string filter, OracleCommand cmdList) { DataSet _dsReq = new DataSet(); _dsReq = objDml.GetRequirementsFlowdown(filter, cmdList); ViewState["reqin"] = _dsReq.Tables["reqin"]; if (_dsReq.Tables["reqin"].Rows.Count > 0) { GVReq.DataSource = _dsReq.Tables["reqin"]; GVReq.DataBind(); } else { GVReq.DataSource = null; GVReq.DataBind(); } }
public void FillGrid() { try { DataTable dtGetReq_ = new DataTable(); //dtGetReq_ = tbl_MReqManager.GetRequisitionList(); GVReq.DataSource = dtGetReq_; GVReq.DataBind(); ViewState["GetReq"] = dtGetReq_; } catch (Exception ex) { throw; //lbl_err.Text = ex.Message; } }