public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtCommodityFatherName.Text.Trim().Length == 0) { strErr += "CommodityFatherName不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string CommodityFatherID = this.lblCommodityFatherID.Text; string CommodityFatherName = this.txtCommodityFatherName.Text; Maticsoft.Model.CommodityFather model = new Maticsoft.Model.CommodityFather(); model.CommodityFatherID = CommodityFatherID; model.CommodityFatherName = CommodityFatherName; Maticsoft.BLL.CommodityFather bll = new Maticsoft.BLL.CommodityFather(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { Maticsoft.Model.CommodityFather modelnew = CommodityFather_BLL.GetModel(Request.QueryString["ID"].ToString());//引用id所在行的数据 if ((CommodityFather_BLL.GetList("CommodityFatherName ='" + RadTextBox1.Text + "'").Tables[0].Rows.Count) != 0 && RadTextBox1.Text != modelnew.CommodityFatherName) { RadAjaxManager1.Alert("请输入不同名称!"); } else { CommodityFather_Model = CommodityFather_BLL.GetModel(Request.QueryString["ID"].ToString()); CommodityFather_Model.CommodityFatherName = RadTextBox1.Text; CommodityFather_BLL.Update(CommodityFather_Model); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>"); } }