//private void HandleSupplementalAgreementsBasedOnFarm(int iPK_FarmBusiness, int? iPK_SupplementalAgreementTaxParcel) private void HandleSupplementalAgreementsBasedOnFarm(int?iPK_SupplementalAgreementTaxParcel) { Panel pnlSA_Available = fvBMPPlanning.FindControl("pnlSA_Available") as Panel; Panel pnlSA_Message = fvBMPPlanning.FindControl("pnlSA_Message") as Panel; Label lblSA_Message = fvBMPPlanning.FindControl("lblSA_Message") as Label; DropDownList ddlSAA = fvBMPPlanning.FindControl("ddlSAA") as DropDownList; DropDownList ddlSA = fvBMPPlanning.FindControl("ddlSA") as DropDownList; using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { //var a = wac.bmp_ag_SAs.Where(w => w.bmp_ag.fk_farmBusiness == iPK_FarmBusiness).Select(s => s.pk_bmp_ag_SA); //if (a.Count() > 0) //{ //if (fvBMPPlanning.CurrentMode == FormViewMode.Insert) WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_FarmBusiness, null, true); //else WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_FarmBusiness, iPK_SupplementalAgreementTaxParcel, true); if (fvBMPPlanning.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, null, true); } else { WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_SupplementalAgreementTaxParcel(ddlSA, iPK_SupplementalAgreementTaxParcel, true); } pnlSA_Message.Visible = false; pnlSA_Available.Visible = true; //} //else //{ // lblSA_Message.Text = "No Supplemental Agreements have been assigned to this farm"; // pnlSA_Available.Visible = false; // pnlSA_Message.Visible = true; //} } }