Exemple #1
0
        protected void NewDisagLvl2Btn_Click(object sender, EventArgs e)
        {
            disaggregation newDisag = new disaggregation();

            newDisag.disaggregation_id   = int.Parse(disaglvl1field.Value.Trim());
            newDisag.disaggregation_name = DisaggregationTxBx.Text.Trim();

            db.disaggregations.Add(newDisag);

            db.SaveChanges();

            ScriptManager.RegisterStartupScript(
                Page,
                Page.GetType(),
                "newDisaggModal", "$('#newDisaggModal').modal('hide');",
                true);

            LinqDataSource5.Where = string.Format("disaggregation_id == {0}",
                                                  disaglvl1field.Value);

            //Disaggregation2DropDown.DataSourceID = "LinqDataSource5";
            Disaggregation2DropDown.DataBind();
            Disaggregation2DropDown.ClearSelection();
            Disaggregation2DropDown.Items.FindByValue(newDisag.id.ToString()).Selected = true;
            Disaggregation2DropDown_SelectedIndexChanged(this, EventArgs.Empty);
        }
Exemple #2
0
        //=============================Begin Section Test================================
        protected void Disaggregation1DropDown_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Disaggregation1DropDown.SelectedValue == "new")
            {
                NewDisagLvl1Btn.Visible = true;
                NewDisagLvl2Btn.Visible = false;
                NewDisagLvl3Btn.Visible = false;

                ScriptManager.RegisterStartupScript(
                    Page,
                    Page.GetType(),
                    "newDisaggModal", "$('#newDisaggModal').modal('show');",
                    true);

                lvl2.Visible = false;
                lvl3.Visible = false;
            }
            else if (Disaggregation1DropDown.SelectedItem.Value == "0")
            {
                lvl2.Visible = false;
                lvl3.Visible = false;
            }
            else if (int.Parse(Disaggregation1DropDown.SelectedItem.Value) > 0)
            {
                disaglvl1field.Value = Disaggregation1DropDown.SelectedItem.Value;

                LinqDataSource5.Where = string.Format("disaggregation_id == {0}",
                                                      Disaggregation1DropDown.SelectedItem.Value);

                Disaggregation2DropDown.DataBind();
                lvl2.Visible = true;
            }
        }