protected void ddlBMPPlanning_ImplementationYears_Insert_SelectedIndexChanged(object sender, EventArgs e) { bool b = WACGlobal_Methods.Security_UserObjectCustom(Session["userID"], WACGlobal_Methods.Enum_Security_UserObjectCustom.A_PLAN); if (b) { StringBuilder sb = new StringBuilder(); DropDownList ddlBMPPlanning_ImplementationYears_Insert = fvBMPPlanning.FindControl("ddlBMPPlanning_ImplementationYears_Insert") as DropDownList; int?i = null; int iCode = 0; using (WACDataClassesDataContext wac = new WACDataClassesDataContext()) { try { short?shYear = null; try { shYear = Convert.ToInt16(ddlBMPPlanning_ImplementationYears_Insert.SelectedValue); } catch { sb.Append("Year is required. "); } iCode = wac.bmp_ag_implementation_add_express(Convert.ToInt32(fvBMPPlanning.DataKey.Value), shYear, "Y", null, Session["userName"].ToString(), ref i); if (iCode == 0) { BindData_BMPPlanning_FormView(Convert.ToInt32(fvBMPPlanning.DataKey.Value)); } else { WACAlert.Show("Error Returned from Database. ", iCode); } } catch (Exception ex) { WACAlert.Show(ex.Message, 0); } } } else { WACAlert.Show("You do not have permission to insert into the BMP Planning Implementation Year table.", 0); } }