protected void FillGrid()
    {
        //DataTable dt = IsValidFormStaffID() ?  StaffOfferingsDB.GetDataTableByStaffID(GetFormStaffID(), false) : StaffOfferingsDB.GetDataTable(false);
        DataTable dt = StaffOfferingsDB.GetDataTable(false, IsValidFormStaffID() ? GetFormStaffID() : -1, IsValidFormOfferingID() ? GetFormOfferingID() : -1);

        dt.Columns.Add("is_active", typeof(bool));
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            dt.Rows[i]["is_active"] = dt.Rows[i]["so_date_active"] == DBNull.Value || Convert.ToDateTime(dt.Rows[i]["so_date_active"]).Date > DateTime.Today ? false : true;
        }
        Session["staff_offerings_data"] = dt;


        this.GrdStaffOfferings.AllowPaging = dt.Rows.Count > 50;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["staff_offerngs_sortexpression"] != null && Session["staff_offerngs_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["staff_offerngs_sortexpression"].ToString();
                GrdStaffOfferings.DataSource = dataView;
            }
            else
            {
                GrdStaffOfferings.DataSource = dt;
            }


            try
            {
                GrdStaffOfferings.DataBind();
                GrdStaffOfferings.PagerSettings.FirstPageText = "1";
                GrdStaffOfferings.PagerSettings.LastPageText  = GrdStaffOfferings.PageCount.ToString();
                GrdStaffOfferings.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdStaffOfferings.DataSource = dt;
            GrdStaffOfferings.DataBind();

            int TotalColumns = GrdStaffOfferings.Rows[0].Cells.Count;
            GrdStaffOfferings.Rows[0].Cells.Clear();
            GrdStaffOfferings.Rows[0].Cells.Add(new TableCell());
            GrdStaffOfferings.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdStaffOfferings.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }