protected void ImgExpExcel_Click(object sender, EventArgs e) { int rowcount = ucCustomPager.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_Crew_CrewList.Get_HandOver_Search(UDFLib.ConvertIntegerToNull(ddlFleet.SelectedValue.ToString()) , UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue.ToString()), txtSearchText.Text, UDFLib.ConvertIntegerToNull(ddlRankFilter.SelectedValue), sortbycoloumn, sortdirection, null, null, ref rowcount); string[] HeaderCaptions = { "Vessel Name", "Staff Code", "Staff Name", "Rank Name", "Hand Over Date", "Sign off Remark" }; string[] DataColumnsName = { "Vessel_Name", "STAFF_CODE", "FULL_NAME", "Rank_Short_Name", "Handover_Date", "Sing_off_Remarks" }; ChangeColumnDataType(dt, "Handover_Date", typeof(string)); foreach (DataRow item in dt.Rows) { if (!string.IsNullOrEmpty(item["Handover_Date"].ToString())) { item["Handover_Date"] = UDFLib.ConvertUserDateFormat(Convert.ToString(item["Handover_Date"]), UDFLib.GetDateFormat()); } } GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "CrewHandOver.xls", "Crew Handover"); }
public void BindMasterReview() { int PAGE_SIZE = ucCustomPager.PageSize; int PAGE_INDEX = ucCustomPager.CurrentPageIndex; int SelectRecordCount = ucCustomPager.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_Crew_CrewList.Get_HandOver_Search(UDFLib.ConvertIntegerToNull(ddlFleet.SelectedValue.ToString()) , UDFLib.ConvertIntegerToNull(ddlVessel.SelectedValue.ToString()), txtSearchText.Text, UDFLib.ConvertIntegerToNull(ddlRankFilter.SelectedValue.ToString()), sortbycoloumn, sortdirection, PAGE_SIZE, PAGE_INDEX, ref SelectRecordCount); if (ucCustomPager.isCountRecord == 1) { ucCustomPager.CountTotalRec = SelectRecordCount.ToString(); ucCustomPager.BuildPager(); } gvMasterReview.DataSource = dt; gvMasterReview.DataBind(); }