protected void grdTypeOfWorkFunctionClassification_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            // Cancel fairWage update
            Session["fairWage"] = "None";

            // New Values
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int projectId = Int32.Parse(((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("lblProjectIDEdit")).Text.Trim());
            string work_ = ((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("lblWork_Edit")).Text.Trim();
            string function_ = ((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("lblFunction_Edit")).Text.Trim();
            int refId = Int32.Parse(((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[1].FindControl("lblRefIDEdit")).Text.Trim());
            bool isFairWage = false; if (((CheckBox)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("cbxIsFairWageEdit")).Checked) isFairWage = true;

            // Update data
            ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS);
            model.Update(projectId, work_, function_, refId, isFairWage, false, companyId);

            // Store dataset
            Session["projectNavigatorTDS"] = projectNavigatorTDS;

            projectTypeOfWorkFunctionClassification = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE;
            Session["projectTypeOfWorkFunctionClassification"] = projectTypeOfWorkFunctionClassification;
        }
        protected void grdTypeOfWorkFunctionClassification_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            // Validate footer if it's a fair wage
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                if (cbxFairWageApplies.Checked)
                {
                    ((CheckBox)e.Row.FindControl("cbxIsFairWageNew")).Checked = true;
                }
                else
                {
                    ((CheckBox)e.Row.FindControl("cbxIsFairWageNew")).Checked = false;
                }
            }

            // Change values if the fair wage state changes.
            if ((Session["fairWage"]).ToString() != "None")
            {
                if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
                {
                    if ((Session["fairWage"]).ToString() == "True")
                    {
                        ((CheckBox)e.Row.FindControl("cbxIsFairWage")).Checked = true;
                    }
                    else
                    {
                        ((CheckBox)e.Row.FindControl("cbxIsFairWage")).Checked = false;
                    }

                    //Save Changes
                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    int projectId = Int32.Parse(((Label)e.Row.FindControl("lblProjectID")).Text.Trim());
                    string work_ = ((Label)e.Row.FindControl("lblWork_")).Text.Trim();
                    string function_ = ((Label)e.Row.FindControl("lblFunction_")).Text.Trim();
                    int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefID")).Text.Trim());
                    bool isFairWage = false; if (((CheckBox)e.Row.FindControl("cbxIsFairWage")).Checked) isFairWage = true;

                    // Update data
                    if (projectId > 0)
                    {
                        ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS);
                        model.Update(projectId, work_, function_, refId, isFairWage, false, companyId);

                        // Store dataset
                        Session["projectNavigatorTDS"] = projectNavigatorTDS;

                        projectTypeOfWorkFunctionClassification = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE;
                        Session["projectTypeOfWorkFunctionClassification"] = projectTypeOfWorkFunctionClassification;
                    }
                }

                if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate))))
                {
                    if ((Session["fairWage"]).ToString() == "True")
                    {
                        ((CheckBox)e.Row.FindControl("cbxIsFairWageEdit")).Checked = true;
                    }
                    else
                    {
                        ((CheckBox)e.Row.FindControl("cbxIsFairWageEdit")).Checked = false;
                    }

                    //Save Changes
                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    int projectId = Int32.Parse(((Label)e.Row.FindControl("lblProjectIDEdit")).Text.Trim());
                    string work_ = ((Label)e.Row.FindControl("lblWork_Edit")).Text.Trim();
                    string function_ = ((Label)e.Row.FindControl("lblFunction_Edit")).Text.Trim();
                    int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefIDEdit")).Text.Trim());
                    bool isFairWage = false; if (((CheckBox)e.Row.FindControl("cbxIsFairWageEdit")).Checked) isFairWage = true;

                    // Update data
                    if (projectId > 0)
                    {
                        ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS);
                        model.Update(projectId, work_, function_, refId, isFairWage, false, companyId);

                        // Store dataset
                        Session["projectNavigatorTDS"] = projectNavigatorTDS;

                        projectTypeOfWorkFunctionClassification = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE;
                        Session["projectTypeOfWorkFunctionClassification"] = projectTypeOfWorkFunctionClassification;
                    }
                 }
            }
        }