//-- Functions
    /// <summary>
    /// bind the Supplier Gridview and all the detalis initially saved against supplier if the supplier's status is "Approved"
    /// </summary>
    private void BindSupplierView()                                                                   //-- Bind Supplier List
    {
        try
        {
            DataSet   dataforDisplay = new DataSet();
            DataTable dtvat          = BLL_PURC_Common.PURC_Get_Sys_Variable(UDFLib.ConvertToInteger(GetSessionUserID()), "VAT");
            DataTable dtWithHold     = BLL_PURC_Common.PURC_Get_Sys_Variable(UDFLib.ConvertToInteger(GetSessionUserID()), "WIthHoldTax");
            Item_bindddl(ddlVAt, dtvat, null);
            Item_bindddl(ddlWithHoldTax, dtWithHold, null);
            using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase())
            {
                dataforDisplay = objTechService.ConfiguredSupplierPreview(DocCode, VesselCode, txt_searchCodeName.Text);
            }
            if ((dataforDisplay.Tables[1].Rows.Count > 0 && txt_searchCodeName.Text.Length > 0) || (dataforDisplay.Tables[1].Rows.Count > 0 && dataforDisplay.Tables[1].Rows[0][0].ToString().Length < 3) || (dataforDisplay.Tables[1].Rows.Count < 1))
            {
                GV_SupplierList.DataSource = dataforDisplay.Tables[0];
                GV_SupplierList.DataBind();
                HD_SelectedSupplier.Value = dataforDisplay.Tables[1].Rows[0]["Supplier_Code"].ToString();
                bindSupp_port();
                ddlSupp_Port.SelectedValue = dataforDisplay.Tables[1].Rows[0]["DELIVERY_PORT"].ToString();
                txt_SuppDate.Text          = UDFLib.ConvertUserDateFormat(dataforDisplay.Tables[1].Rows[0]["DELIVERY_DATE"].ToString().Length > 8 ? dataforDisplay.Tables[1].Rows[0]["DELIVERY_DATE"].ToString().Remove(10) : "");
                txt_Discount.Text          = dataforDisplay.Tables[1].Rows[0]["DISCOUNT"].ToString().Split('.')[0];
                txt_Advance.Text           = dataforDisplay.Tables[1].Rows[0]["Advance_Payment"].ToString().Split('.')[0];
            }

            else
            {
                GV_SupplierList.DataSource = dataforDisplay.Tables[1];
                GV_SupplierList.DataBind();
                //CheckBox rbtn = (CheckBox)GV_SupplierList.Rows[0].FindControl("rbtn_suppselect");
                //rbtn.Checked = true;
                GV_SupplierList.Rows[0].BackColor = System.Drawing.Color.SkyBlue;
                HD_SelectedSupplier.Value         = dataforDisplay.Tables[1].Rows[0]["Supplier_Code"].ToString();
                bindSupp_port();
                ddlSupp_Port.SelectedValue   = dataforDisplay.Tables[1].Rows[0]["DELIVERY_PORT"].ToString();
                txt_SuppDate.Text            = UDFLib.ConvertUserDateFormat(dataforDisplay.Tables[1].Rows[0]["DELIVERY_DATE"].ToString().Length > 8 ? dataforDisplay.Tables[1].Rows[0]["DELIVERY_DATE"].ToString().Remove(10) : "");
                txt_Discount.Text            = dataforDisplay.Tables[1].Rows[0]["DISCOUNT"].ToString().Split('.')[0];
                txt_Advance.Text             = dataforDisplay.Tables[1].Rows[0]["Advance_Payment"].ToString().Split('.')[0];
                ddlVAt.SelectedValue         = dataforDisplay.Tables[1].Rows[0]["VAT_Rate"].ToString().Length != null ? dataforDisplay.Tables[1].Rows[0]["VAT_Rate"].ToString() : "0";
                ddlWithHoldTax.SelectedValue = dataforDisplay.Tables[1].Rows[0]["Withholding_Tax_Rate"].ToString() != null ? dataforDisplay.Tables[1].Rows[0]["Withholding_Tax_Rate"].ToString() : "0";
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }
 protected void OnPagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)             //-- OnPage Change change pager index
 {
     (GV_SupplierList.FindControl("DataPager1") as DataPager).SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
     this.BindSupplierView();
 }