private int m_uid = 1; //测试用 #endregion Fields #region Methods protected void EBtnSubmit_Click(object sender, EventArgs e) { string strusername = TxtUserName.Text.Trim(); string strcontent = TxtRequireContent.Text.Trim(); B_ClientRequire bclientrequire = new B_ClientRequire(); M_ClientRequire mrequire=new M_ClientRequire(); mrequire.Require=strcontent; mrequire.UserID=this.m_uid; mrequire.ReuqireDate=DateTime.Now; if (bclientrequire.Add(mrequire)) { Response.Write("<script language=javascript> alert('添加成功!');window.document.location.href='ProjectList.aspx';</script>"); } }
//批量删除 protected void btnDel_Click(object sender, EventArgs e) { B_ClientRequire bll = new B_ClientRequire(); for (int i = 0; i <= Egv.Rows.Count - 1; i++) { CheckBox cbox = (CheckBox)Egv.Rows[i].FindControl("chkSel"); if (cbox.Checked == true) { btnDel.Attributes.Add("OnClientClick", "return confirm('你确定要删除吗?');"); bll.DeleteByRID(DataConverter.CLng(Egv.DataKeys[i].Value)); } } Bind(); }
private void Bind() { B_ClientRequire bll = new B_ClientRequire(); DataView dv = bll.GetClientRequireAll(); this.Egv.DataSource = dv; this.Egv.DataKeyNames = new string[] { "RequireID" }; this.Egv.DataBind(); }