protected void NewDisagLvl3Btn_Click(object sender, EventArgs e) { disaggregation newDisag = new disaggregation(); newDisag.disaggregation_id = int.Parse(disaglvl2field.Value.Trim()); newDisag.disaggregation_name = DisaggregationTxBx.Text.Trim(); db.disaggregations.Add(newDisag); db.SaveChanges(); ScriptManager.RegisterStartupScript( Page, Page.GetType(), "newDisaggModal", "$('#newDisaggModal').modal('hide');", true); LinqDataSource6.Where = string.Format("disaggregation_id == {0}", disaglvl2field.Value); //Disaggregation2DropDown.DataSourceID = "LinqDataSource5"; Disaggregation3DropDown.DataBind(); Disaggregation3DropDown.ClearSelection(); Disaggregation3DropDown.Items.FindByValue(newDisag.id.ToString()).Selected = true; Disaggregation3DropDown_SelectedIndexChanged(this, EventArgs.Empty); }
protected void Disaggregation2DropDown_SelectedIndexChanged(object sender, EventArgs e) { if ((Disaggregation2DropDown.SelectedValue == "new") && (!string.IsNullOrEmpty(disaglvl1field.Value))) { NewDisagLvl1Btn.Visible = false; NewDisagLvl2Btn.Visible = true; NewDisagLvl3Btn.Visible = false; ScriptManager.RegisterStartupScript( Page, Page.GetType(), "newDisaggModal", "$('#newDisaggModal').modal('show');", true); lvl3.Visible = false; } else if (Disaggregation2DropDown.SelectedItem.Value == "0") { lvl3.Visible = false; } else if ((int.Parse(Disaggregation2DropDown.SelectedItem.Value) > 0) && (!string.IsNullOrEmpty(disaglvl1field.Value))) { disaglvl2field.Value = Disaggregation2DropDown.SelectedItem.Value; LinqDataSource6.Where = string.Format("disaggregation_id == {0}", disaglvl2field.Value); Disaggregation3DropDown.DataBind(); lvl3.Visible = true; } }