protected void ImgExpExcel_Click(object sender, ImageClickEventArgs 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()); DataTable dt = BLL_Tec_ErLog.ErLog_ME_00_Search(UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), txtFromDate.Text, txtToDate.Text, sortbycoloumn, sortdirection , 1, int.MaxValue, ref rowcount); dt.Columns.Add("AML", typeof(string)); foreach (DataRow item in dt.Rows) { if (item["Anomaly_Value"].ToString() == "1") { item["AML"] = "Yes"; } else { item["AML"] = "No"; } } string[] HeaderCaptions = { "Voyage Numbe", "Vessel Name", "From", "TO", "Date", "Remarks", "Anomaly Present" }; string[] DataColumnsName = { "VOYAGE_NUM", "VESSEL_NAME", "FROMPORT", "TOPORT", "LOG_DATE", "CE_REMARKS", "AML" }; GridViewExportUtil.ExportToExcel(dt, HeaderCaptions, DataColumnsName, "EngineRoomLogBookIndex", "Engine Room Log Book Index "); }
public void BindIndex() { 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()); DataTable dt = BLL_Tec_ErLog.ErLog_ME_00_Search(UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), txtFromDate.Text, txtToDate.Text, sortbycoloumn, sortdirection , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { gvERLogIndex.DataSource = dt; gvERLogIndex.DataBind(); } else { gvERLogIndex.DataSource = dt; gvERLogIndex.DataBind(); } }