protected void dropDownListCounselorCounty_SelectedIndexChanged(object sender, EventArgs e) { var dropDownListCounselorZipCode = formViewEditClientContact.FindControl("dropDownListCounselorZipCode") as DropDownList; dropDownListCounselorZipCode.DataSource = LookupBLL.GetZipCodeForCountyFips(((DropDownList)sender).SelectedValue); dropDownListCounselorZipCode.DataBind(); dropDownListCounselorZipCode.Items.Insert(0, new ListItem("-- Select a Zip Code --", "")); dropDownListCounselorZipCode.Focus(); }
protected void dropDownListCounselor_SelectedIndexChanged(object sender, EventArgs e) { var dropDownListCounselor = (DropDownList)sender; var counselorIdSelected = (!string.IsNullOrEmpty(dropDownListCounselor.SelectedValue)) ? Convert.ToInt32(dropDownListCounselor.SelectedValue) : 0; if (counselorIdSelected == 0) { return; } var counselor = UserBLL.GetUserAccount(counselorIdSelected); if (counselor == null) { return; } var dropDownListCounselorCounty = formViewEditClientContact.FindControl("dropDownListCounselorCounty") as DropDownList; dropDownListCounselorCounty.DataSource = AgencyLogic.GetCounties(ViewData.AgencyState.Code); dropDownListCounselorCounty.DataBind(); dropDownListCounselorCounty.Items.Insert(0, new ListItem("-- Select a County --", "")); var county = dropDownListCounselorCounty.Items.FindByValue(counselor.CounselingCounty); if (county != null) { county.Selected = true; } var dropDownListCounselorZipCode = formViewEditClientContact.FindControl("dropDownListCounselorZipCode") as DropDownList; dropDownListCounselorZipCode.DataSource = LookupBLL.GetZipCodeForCountyFips(counselor.CounselingCounty); dropDownListCounselorZipCode.DataBind(); dropDownListCounselorZipCode.Items.Insert(0, new ListItem("-- Select a Zip Code --", "")); var zip = dropDownListCounselorZipCode.Items.FindByText(counselor.CounselingLocation); if (zip != null) { zip.Selected = true; } dropDownListCounselorCounty.Focus(); }