protected void Load_Allotments()
    {
        int?AmountValue = chkAmountIsGreaterthanZero.Checked == true?UDFLib.ConvertIntegerToNull(1) : null;

        gvAllotments.PageSize = int.Parse(ddlPageSize.SelectedValue);

        DataTable dt = BLL_PB_PortageBill.Get_Allotments(int.Parse(ddlFleet.SelectedValue)
                                                         , int.Parse(ddlVessel.SelectedValue)
                                                         , ddlMonth.SelectedValue
                                                         , ddlYear.SelectedValue
                                                         , int.Parse(ddlApproval.SelectedValue)
                                                         , int.Parse(DDLBank.SelectedValue)
                                                         , int.Parse(ddlStatus.SelectedValue)
                                                         , txtSearch.Text
                                                         , CrewID
                                                         , UDFLib.ConvertIntegerToNull(rbtnVerificationStatus.SelectedValue)
                                                         , null
                                                         , AmountValue
                                                         , chkFlagedItems.Checked
                                                         , Convert.ToInt32(ddlCountry.SelectedValue));

        gvAllotments.DataSource = dt;
        gvAllotments.DataBind();

        DataTable dtIDs = new DataTable();

        dtIDs.Columns.Add("ID");
        dtIDs.Columns.Add("AllotmentID");
        dtIDs.Columns.Add("PBDate", typeof(DateTime));
        DataRow drID;

        foreach (DataRow dr in dt.Rows)
        {
            drID                = dtIDs.NewRow();
            drID["ID"]          = dr["id"].ToString();
            drID["AllotmentID"] = dr["AllotmentID"].ToString();
            drID["PBDate"]      = dr["PBill_Date"];
            dtIDs.Rows.Add(drID);
        }

        ctlRecordNavigationAllotment.InitRecords(dtIDs);


        lblRecordCount.Text = dt.Rows.Count.ToString();
        if (gvAllotments.PageCount > 0)
        {
            lblPageStatus.Text = (gvAllotments.PageIndex + 1).ToString() + " of " + gvAllotments.PageCount.ToString();
        }
        else
        {
            lblPageStatus.Text = "0 of 0";
        }
        UpdatePanel2.Update();



        DateTime?pbilldate = BLL_PB_PortageBill.Get_Valid_Date_TO_Rework_Allotment(Convert.ToInt32(ddlVessel.SelectedValue));


        if (pbilldate != null && objUA.Admin == 1)
        {
            btnReworkAllotmentToVessel.Text            = "Rework allotment [" + Convert.ToDateTime(pbilldate).ToString("MMM-yyyy") + "] to " + ddlVessel.SelectedItem.Text;
            btnReworkAllotmentToVessel.CommandArgument = pbilldate.ToString();

            btnReworkAllotmentToVessel.Visible = true;
        }
    }