private void BindData_Ag_BMPPractice(decimal d) { using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { var a = wac.list_bmpPractices.Where(w => w.pk_bmpPractice_code == d).Select(s => s); fvList_Ag_BMPPractice.DataKeyNames = new string[] { "pk_bmpPractice_code" }; fvList_Ag_BMPPractice.DataSource = a; fvList_Ag_BMPPractice.DataBind(); if (fvList_Ag_BMPPractice.CurrentMode == FormViewMode.Insert) { WACGlobal_Methods.PopulateControl_DatabaseLists_Agency_DDL(fvList_Ag_BMPPractice, "ddlAgency", null); WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_Lifespan_DDL(fvList_Ag_BMPPractice.FindControl("ddlLifespan") as DropDownList, null, false); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvList_Ag_BMPPractice, "ddlAgronomic", null); WACGlobal_Methods.PopulateControl_DatabaseLists_Unit_DDL(fvList_Ag_BMPPractice, "ddlUnit", null); WACGlobal_Methods.PopulateControl_DatabaseLists_WACPracticeCategory_DDL(fvList_Ag_BMPPractice.FindControl("ddlWACPracticeCategory") as DropDownList, null); } if (fvList_Ag_BMPPractice.CurrentMode == FormViewMode.Edit) { WACGlobal_Methods.PopulateControl_DatabaseLists_Agency_DDL(fvList_Ag_BMPPractice, "ddlAgency", a.Single().fk_agency_code); WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_Lifespan_DDL(fvList_Ag_BMPPractice.FindControl("ddlLifespan") as DropDownList, a.Single().life_reqd_yr, false); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvList_Ag_BMPPractice, "ddlAgronomic", a.Single().agronomic); WACGlobal_Methods.PopulateControl_DatabaseLists_Unit_DDL(fvList_Ag_BMPPractice, "ddlUnit", a.Single().fk_unit_code); WACGlobal_Methods.PopulateControl_DatabaseLists_WACPracticeCategory_DDL(fvList_Ag_BMPPractice.FindControl("ddlWACPracticeCategory") as DropDownList, a.Single().fk_list_wacPracticeCategory); WACGlobal_Methods.PopulateControl_Generic_YesNoDDL(fvList_Ag_BMPPractice, "ddlActive", a.Single().active, false); } } }