protected void btnAddQY_Click(object sender, EventArgs e) { Model.GcConfig mzd = new Model.GcConfig(); BLL.GcConfig bzd = new BLL.GcConfig(); mzd.Name = txtqymc.Text.Trim(); mzd.Ename = txtpx.Text.Trim(); mzd.Types = types; mzd.Content = txtcontent.Text.Trim().FilterSql(); bzd.Add(mzd); txtqymc.Text = ""; txtpx.Text = ""; txtcontent.Text = ""; BindGridView(); }
//执行编辑 protected void gvqy_RowUpdating(object sender, GridViewUpdateEventArgs e) { int qyid = gvqy.DataKeys[e.RowIndex][0].GetString().GetInt(); TextBox txtqymc = gvqy.Rows[e.RowIndex].FindControl("txtqymc") as TextBox; TextBox txtqypx = gvqy.Rows[e.RowIndex].FindControl("txtqypx") as TextBox; TextBox txtcontent = gvqy.Rows[e.RowIndex].FindControl("txtcontent") as TextBox; BLL.GcConfig bbk = new BLL.GcConfig(); Model.GcConfig mbk = new Model.GcConfig(); mbk = bbk.GetModel(qyid); mbk.Name = txtqymc.Text; mbk.Ename = txtqypx.Text; mbk.Types = types; mbk.Content = txtcontent.Text; bbk.Update(mbk); gvqy.EditIndex = -1; BindGridView(); }