public void BindVesselGrid() { 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 = objBLL.SearchVessel(txtfilter.Text != "" ? txtfilter.Text : null, UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlFilterVesselManager.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVesselFlag.SelectedValue), UDFLib.ConvertIntegerToNull(ddlFilterVesselManager.SelectedValue), null, UDFLib.ConvertIntegerToNull(ddlvesselType.SelectedValue) , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (dt.Rows.Count > 0) { VesselGridView.DataSource = dt; VesselGridView.DataBind(); } else { VesselGridView.DataSource = dt; VesselGridView.DataBind(); } }
protected void ImgExpExcel_Click(object sender, EventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; int UserCompanyID = UDFLib.ConvertToInteger(Session["USERCOMPANYID"].ToString()); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = objBLL.SearchVessel(txtfilter.Text != "" ? txtfilter.Text : null, UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlFilterVesselManager.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVesselFlag.SelectedValue), UDFLib.ConvertIntegerToNull(ddlFilterVesselManager.SelectedValue), null, UDFLib.ConvertIntegerToNull(ddlvesselType.SelectedValue) , sortbycoloumn, sortdirection, null, null, ref rowcount); string[] HeaderCaptions = { "Name", "Short Name", "E-Mail", "Fleet", "Vessel Manager", "Vessel Flag", "Min CTM", "Sync Flag" }; string[] DataColumnsName = { "Vessel_Name", "Vessel_Short_Name", "Vessel_EMail", "FleetName", "VesselManager", "Flag_Name", "Min_CTM", "ODM_ENABLED" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "Vessel", "Vessel", ""); }