Example #1
0
    protected void Button532_Click(object sender, EventArgs e)
    {
        if (Label533.Text == "请选择单位")
        {
            ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('还没选择单位呢,请选择单位后再提交!')", true);
        }
        else
        {
            int a = bom.Insert_IMUnitChange(new Guid(Label38.Text), new Guid(Label534.Text), decimal.Parse(TextBox24.Text));
            if (a == -1)
            {
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('已存在该单位啦.')", true);
            }
            else
            {
                DropDownList3.Items.Clear();
                SqlDataReader myReader = bom.Query_MUnit(new Guid(Label38.Text));

                while (myReader.Read())
                {
                    DropDownList3.Items.Add(new ListItem(myReader["UnitName"].ToString(), myReader["UnitID"].ToString()));//增加Item
                }
                Panel53.Visible = false;
                UpdatePanel4.Update();
                UpdatePanel5.Update();
            }
        }
    }