protected void Button2_Click(object sender, EventArgs e) { XYECOM.Business.Role r = new XYECOM.Business.Role(); XYECOM.Model.RoleInfo er = new XYECOM.Model.RoleInfo(); er.UR_ID = Convert.ToInt16(this.hidUR_ID.Value); er.UR_Name = this.TextBox1.Text; int i = 0; i = r.Update(er); if (i >= 0) { this.ClientScript.RegisterClientScriptBlock(GetType(), "01", "<script>location.href='"+url+"';</script>"); gvDataBaind(); } else { Alert("修改失败!", url); } }
protected void btnOk_ServerClick(object sender, EventArgs e) { XYECOM.Business.Role r = new XYECOM.Business.Role(); XYECOM.Model.RoleInfo er = new XYECOM.Model.RoleInfo(); er.UR_Name = this.txtName.Text; int err = r.Insert(er); if (err == -1) { Alert("该记录已存在!请重新输入信息!", url); } else if (err == -2) { Alert("添加失败!", url); } else { gvDataBaind(); } }