protected void btnExportExcel_Click(object sender, ImageClickEventArgs e)
        {
            try
            {
                int total = lblTotal.Text == "" ? 0 : lblTotal.Text.ToInt();
                if (total > base.EXCEL_SIZE_Key)
                {
                    UCModalError.ShowMessageError = SysMessage.ExcelSizeError;
                    UCModalError.ShowModalError();
                    UpdatePanelGv.Update();
                }
                else
                {
                    ExportBiz export = new ExportBiz();
                    Dictionary <string, string> columns = new Dictionary <string, string>();
                    columns.Add("ลำดับ", "RUN_NO");
                    columns.Add("เลขที่ใบสั่งจ่ายกลุ่ม", "GROUP_REQUEST_NO");
                    columns.Add("วันครบกำหนดชำระ", "EXPIRATION_DATE");
                    columns.Add("จำนวนเงินในใบสั่งจ่ายกลุ่ม", "GROUP_AMOUNT");

                    List <HeaderExcel> header = new List <HeaderExcel>();
                    header.Add(new HeaderExcel
                    {
                        NameColumnsOne  = "วันที่ต้องชำระเงิน(เริ่ม) ",
                        ValueColumnsOne = txtStartPaidSubDate.Text,
                        NameColumnsTwo  = "วันที่ต้องชำระเงิน(สิ้นสุด) ",
                        ValueColumnsTwo = txtEndPaidSubDate.Text
                    });

                    header.Add(new HeaderExcel
                    {
                        NameColumnsOne  = "วันที่สอบ ",
                        ValueColumnsOne = txtTestingDate.Text,
                        NameColumnsTwo  = "รหัสรอบสอบ ",
                        ValueColumnsTwo = txtTestingNo.Text
                    });

                    header.Add(new HeaderExcel
                    {
                        NameColumnsOne  = "รหัสสนามสอบ ",
                        ValueColumnsOne = txtExamPlaceCode.Text
                    });



                    var biz = new BLL.PaymentBiz();
                    var res = biz.GetApplicantNoPaymentHeadder(Convert.ToDateTime(txtStartPaidSubDate.Text),
                                                               Convert.ToDateTime(txtEndPaidSubDate.Text), txtTestingDate.Text, txtTestingNo.Text, txtExamPlaceCode.Text, 1, base.EXCEL_SIZE_Key, false);
                    export.CreateExcel(res.DataResponse.Tables[0], columns, header, base.UserProfile);
                }
            }
            catch { }
        }
        private void BindDataInGridview(Boolean CountAgain)
        {
            var    biz    = new BLL.PaymentBiz();
            string ErrMsg = "";

            if (txtStartPaidSubDate.Text == "")
            {
                Set_textDate(1);
            }
            if (txtEndPaidSubDate.Text == "")
            {
                Set_textDate(2);
            }
            int resultPage;

            int DayValue = lblDayValue.Text == "" ? 0 : lblDayValue.Text.ToInt();

            if (Convert.ToDateTime(txtStartPaidSubDate.Text) > DateTime.Today.AddDays(-DayValue))
            {
                ErrMsg = ErrMsg + "<br />- วันที่หมดอายุใบสั่งจ่าย(เริ่ม) ต้องน้อยกว่าวันที่ปัจจุบัน " + DayValue + " วัน";
                Set_textDate(1);
            }
            if (Convert.ToDateTime(txtEndPaidSubDate.Text) > DateTime.Today.AddDays(-DayValue))
            {
                ErrMsg = ErrMsg + "<br />- วันที่หมดอายุใบสั่งจ่าย(สิ้นสุด) ต้องน้อยกว่าวันที่ปัจจุบัน " + DayValue + " วัน";
                Set_textDate(2);
            }

            if (ErrMsg != "")
            {
                UCModalError.ShowMessageError = ErrMsg;
                UCModalError.ShowModalError();
            }
            else
            {
                if (!string.IsNullOrEmpty(txtStartPaidSubDate.Text) && !string.IsNullOrEmpty(txtEndPaidSubDate.Text))
                {
                    int Rpage = (txtNumberGvSearch.Text.Trim() == "") ? 0 : txtNumberGvSearch.Text.Trim().ToInt();
                    resultPage = (Rpage == 0) ? 1 : txtNumberGvSearch.Text.Trim().ToInt();
                    if ((rowPerpage.Text.Trim() == null) || (rowPerpage.Text.Trim() == "") || (rowPerpage.Text.ToInt() <= 0))
                    {
                        rowPerpage.Text = PageSize.ToString();
                    }
                    else
                    {
                        PageSize = Convert.ToInt32(rowPerpage.Text);
                    }


                    string TestNoo = txtTestingNo.Text.Trim() != "" ? txtTestingNo.Text.Trim() : "%";
                    string PlaceC  = txtExamPlaceCode.Text.Trim() != "" ? txtExamPlaceCode.Text.Trim() : "%";
                    if (CountAgain)
                    {
                        #region Page

                        var CountPage = biz.GetApplicantNoPaymentHeadder(Convert.ToDateTime(txtStartPaidSubDate.Text),
                                                                         Convert.ToDateTime(txtEndPaidSubDate.Text), txtTestingDate.Text, TestNoo, PlaceC, resultPage, PageSize, true);

                        if (CountPage.DataResponse != null)
                        {
                            if (Convert.ToInt32(CountPage.DataResponse.Tables[0].Rows[0]["CCount"].ToString()) > 0)
                            {
                                Int32 totalROWs = Convert.ToInt32(CountPage.DataResponse.Tables[0].Rows[0]["CCount"].ToString());

                                VisibleGV(gvSearch, totalROWs, Convert.ToInt32(rowPerpage.Text), true);
                                if (Rpage == 0)
                                {
                                    NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage);
                                }
                            }
                            else
                            {
                                VisibleGV(gvSearch, 0, Convert.ToInt32(rowPerpage.Text), true);
                                if (Rpage == 0)
                                {
                                    NPbutton(btnPreviousGvSearch, txtNumberGvSearch, btnNextGvSearch, "", txtTotalPage);
                                }
                                txtTotalPage.Text = "1";
                            }
                        }

                        #endregion Page
                    }
                    var res = biz.GetApplicantNoPaymentHeadder(Convert.ToDateTime(txtStartPaidSubDate.Text),
                                                               Convert.ToDateTime(txtEndPaidSubDate.Text), txtTestingDate.Text, TestNoo, PlaceC, resultPage, PageSize, false);

                    if (res.IsError)
                    {
                        var errorMsg = res.ErrorMsg;

                        UCModalError.ShowMessageError = res.ErrorMsg;
                        UCModalError.ShowModalError();
                    }
                    else
                    {
                        gvSearch.DataSource = res.DataResponse;
                        gvSearch.DataBind();

                        if (gvSearch.Rows.Count > 0)
                        {
                            btnDelete.Visible = true;
                            CheckBox ch_all = (CheckBox)gvSearch.HeaderRow.FindControl("CheckAll");
                            ch_all.Visible = true;
                        }
                        else
                        {
                            btnDelete.Visible = false;
                            CheckBox ch_all = (CheckBox)gvSearch.HeaderRow.FindControl("CheckAll");
                            ch_all.Visible = false;
                        }
                        gvSearch.Visible                = true;
                        gv2.Visible                     = false;
                        gvApplicantNoPay.Visible        = false;
                        lblDetailCandidateNoPay.Visible = false;
                        detaiLL.Visible                 = false;
                    }
                }

                else
                {
                    UCModalError.ShowMessageError = SysMessage.PleaseSelectDate;
                    UCModalError.ShowModalError();
                }
            }
        }