示例#1
0
    private void BindAg_WFP3_BMP()
    {
        FormView fv = fvAg_WFP3_BMP;

        using (WACDataClassesDataContext wDataContext = new WACDataClassesDataContext())
        {
            var a = wDataContext.vw_form_wfp3_BMPs.Where(w => w.pk_form_wfp3_bmp == PK_Wfp3Bmp).Select(s => s);
            fv.DataKeyNames = new string[] { "pk_form_wfp3_bmp" };
            fv.DataSource   = a;
            fv.DataBind();

            if (fv.CurrentMode == FormViewMode.Insert)
            {
                // JWJ 9/17/2012 changes parameter 3 from { 0,1 } to { 0 } re: BA934
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByFarmBusiness_DDL(fv.FindControl("ddlBMP") as DropDownList, Convert.ToInt32(FK_FarmBusiness), null, new int?[] { 0 }, true);
            }

            if (fv.CurrentMode == FormViewMode.Edit)
            {
                // JWJ 9/17/2012 changes parameter 3 from { 0,1 } to { 0 } re: BA934
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_BMP_ByFarmBusiness_DDL(fv.FindControl("ddlBMP") as DropDownList, Convert.ToInt32(FK_FarmBusiness), a.Single().pk_bmp_ag, new int?[] { 0 }, true);
                //var b = wDataContext.bmp_ags.Where(w => w.pk_bmp_ag == a.Single().pk_bmp_ag).Select(s => s);
                WACGlobal_Methods.PopulateControl_Custom_Agriculture_Units_By_BMPPractice(a.Single().fk_bmpPractice_code, fv.FindControl("lblAg_WFP3_BMP_Units") as Label);
            }
        }
    }