public void BindGridView() { try { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_POLOG_Register.POLOG_Get_Stale_PO_Report(UDFLib.ConvertStringToNull(ddlSupplier.SelectedValue), UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), UDFLib.ConvertStringToNull(ddlAging.SelectedValue), ddlView.SelectedValue, UDFLib.ConvertIntegerToNull(GetSessionUserID()), sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (ds.Tables[0].Rows.Count > 0) { divPendingInvoice.Visible = true; gvPurchase.DataSource = ds.Tables[0]; gvPurchase.DataBind(); Label lblReportUSDValue1 = (Label)gvPurchase.FooterRow.FindControl("lblReportUSDValue1"); lblReportUSDValue1.Text = ds.Tables[1].Rows[0]["PO_USD_Value"].ToString(); } else { divPendingInvoice.Visible = false; gvPurchase.DataSource = ds.Tables[0]; gvPurchase.DataBind(); gvPurchase.EmptyDataText = "NO RECORDS FOUND"; } } catch { } { } }
protected void ImgExpExcel_Click(object sender, EventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_POLOG_Register.POLOG_Get_Stale_PO_Report(UDFLib.ConvertStringToNull(ddlSupplier.SelectedValue), UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue), UDFLib.ConvertStringToNull(ddlAging.SelectedValue), ddlView.SelectedValue, UDFLib.ConvertIntegerToNull(GetSessionUserID()), sortbycoloumn, sortdirection , null, null, ref rowcount); //"PO Date","Amount", "Cur", "USD Amt", "Supplier Code", "Supplier Name", "Created By", "Approved By" //"Line_Date",,"Line_Amount","Line_Currency","Report_USD_Value","Supplier_Code","Supplier_Name","Created_by", "Line_Status_Updated_by" string[] HeaderCaptions = { "Vessel Name", "PO Code", "Aging Days", "PO Date", "Amount", "Cur", "USD Amt", "Supplier Code", "Supplier Name", "Created By", "Approved By" }; string[] DataColumnsName = { "Vessel_Name", "Office_Ref_Code", "Laspe_Day", "Line_Date", "Line_Amount", "Line_Currency", "Report_USD_Value", "Supplier_Code", "Supplier_Name", "Created_by", "Line_Status_Updated_by" }; GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "Stale PO Report", "Stale PO Report", ""); }