protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        int?deptcode = null; if (DDLOfficeDept.SelectedValue != "0")
        {
            deptcode = Int32.Parse(DDLOfficeDept.SelectedValue);
        }
        int?year = null; if (ddlYear.SelectedValue != "0")
        {
            year = Int32.Parse(ddlYear.SelectedValue.ToString());
        }
        int?month = null; if (ddlMonth.SelectedValue != "0")
        {
            month = Int32.Parse(ddlMonth.SelectedValue.ToString());
        }
        int?smsnextreview = null; if (optSMSReview.SelectedValue != "2")
        {
            smsnextreview = Int32.Parse(optSMSReview.SelectedValue);
        }
        int?responsestatus = null; if (optResponseStatus.SelectedValue != "2")
        {
            responsestatus = Int32.Parse(optResponseStatus.SelectedValue);
        }

        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_SCM_Report.SCMReportOfficeResponseSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(vesselcode)
                                                                  , null, deptcode, year, month, txtSearchBy.Text.Trim(), smsnextreview, responsestatus
                                                                  , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

        string[] HeaderCaptions  = { "Vessel", "Month", "Year", "Department", "Tab Name", "Vessel Issue", "Created By", "Office Response" };
        string[] DataColumnsName = { "Vessel_Name", "Month", "Year", "Dept_Name", "Tab_Name", "Vessel_Issue", "Issue_Created_By", "Office_Response" };

        GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "SCM Office Response", "SCM Office Response", HtmlFilterTable());
    }
    public void BindSCMResponseSearch()
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        int?deptcode = null; if (DDLOfficeDept.SelectedValue != "0")
        {
            deptcode = Int32.Parse(DDLOfficeDept.SelectedValue);
        }
        int?year = null; if (ddlYear.SelectedValue != "0")
        {
            year = Int32.Parse(ddlYear.SelectedValue.ToString());
        }
        int?month = null; if (ddlMonth.SelectedValue != "0")
        {
            month = Int32.Parse(ddlMonth.SelectedValue.ToString());
        }

        int?smsnextreview = null; if (optSMSReview.SelectedValue != "2")
        {
            smsnextreview = Int32.Parse(optSMSReview.SelectedValue);
        }

        int?responsestatus = null; if (optResponseStatus.SelectedValue != "2")
        {
            responsestatus = Int32.Parse(optResponseStatus.SelectedValue);
        }

        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_SCM_Report.SCMReportOfficeResponseSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(vesselcode)
                                                                  , null, deptcode, year, month, txtSearchBy.Text.Trim(), smsnextreview, responsestatus
                                                                  , 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)
        {
            gvSCMResponse.DataSource = ds.Tables[0];
            gvSCMResponse.DataBind();

            if (ViewState["ID"] == null)
            {
                ViewState["ID"] = ds.Tables[0].Rows[0]["ResponseID"].ToString();
                //gvSCMResponse.SelectedIndex = 0;
            }

            // SetRowSelection();
        }
        else
        {
            gvSCMResponse.DataSource = ds.Tables[0];
            gvSCMResponse.DataBind();
        }
    }