protected void ImgExpExcel_Click(object sender, EventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; string InvoiceStatus = null; DataTable dtType = ChkType(); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } string str; if (chkClosePO.Checked == true) { str = "yes"; } else { str = "No"; } DataTable dt = BLL_POLOG_Register.POLOG_Get_PO_Search(txtfilter.Text.Trim() != "" ? txtfilter.Text.Trim() : null, UDFLib.ConvertStringToNull(ddlSupplier.SelectedValue), UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), UDFLib.ConvertStringToNull(ddlAccClassification.SelectedValue), UDFLib.ConvertStringToNull(ddlAccountType.SelectedValue), UDFLib.ConvertStringToNull(InvoiceStatus), dtType, str, sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); string[] HeaderCaptions = { "Created Date", "Office Ref. Code", "Supplier Name", "Line Currency", "Total Amount", "Invoice Amount", "Invoice Count" }; string[] DataColumnsName = { "Created_Date", "Office_Ref_Code", "Supplier Name", "Line Currency", "TotalAmount", "Invoice_Amount", "Invoice_Count" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "PO LOG", "PO LOG", ""); }
public void BindGrid() { try { //objChangeReqstMerge.AddMergedColumns(new int[] { 3 }, "Supplier", "HeaderStyle-center"); objChangeReqstMerge.AddMergedColumns(new int[] { 4, 5 }, "PO", "HeaderStyle-center"); objChangeReqstMerge.AddMergedColumns(new int[] { 6, 7 }, "Invoice", "HeaderStyle-center"); int rowcount = ucCustomPagerItems.isCountRecord; string InvoiceStatus = null; DataTable dtType = ChkType(); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } string str; if (chkClosePO.Checked == true) { str = "yes"; } else { str = "No"; } DataTable dt = BLL_POLOG_Register.POLOG_Get_PO_Search(txtfilter.Text.Trim() != "" ? txtfilter.Text.Trim() : null, UDFLib.ConvertStringToNull(ddlSupplier.SelectedValue), UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), UDFLib.ConvertStringToNull(ddlAccClassification.SelectedValue), UDFLib.ConvertStringToNull(ddlAccountType.SelectedValue), UDFLib.ConvertStringToNull(InvoiceStatus), dtType, str, sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); Object sender = new Object(); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { try { gvPO.DataSource = dt; gvPO.DataBind(); if (HdnId.Value != "") { DataView dv = dt.DefaultView; dv.RowFilter = "ID ='" + HdnId.Value + "'"; dt = dv.ToTable(); } //this.iFrame1.Attributes["src"] = "PO_Log.aspx?SUPPLY_ID=" + dt.Rows[0]["SUPPLY_ID"].ToString() + "&POType=" + dt.Rows[0]["SType"].ToString() + ""; gvPO.Rows[0].BackColor = System.Drawing.Color.Yellow; iFrame1.Attributes.Add("src", "PO_Log.aspx?SUPPLY_ID=" + dt.Rows[0]["SUPPLY_ID"].ToString() + "&POType=" + dt.Rows[0]["SType"].ToString() + ""); HdnId.Value = ""; } catch { } } else { gvPO.DataSource = dt; gvPO.DataBind(); } } catch { } { } }