protected void Button2_Click(object sender, EventArgs e) { Bll.CategoryTable Bct = new Bll.CategoryTable(); this.GridView1.DataSource = Bct.select("BookCategory like '%" + txtCategory.Text + "%'"); this.GridView1.DataKeyNames = new string[] { "ID" }; this.GridView1.DataBind(); }
public void bind() { Bll.CategoryTable Bct = new Bll.CategoryTable(); this.GridView1.DataSource = Bct.select(""); this.GridView1.DataKeyNames = new string[] { "ID" }; this.GridView1.DataBind(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Mct.ID = int.Parse(GridView1.Rows[e.RowIndex].Cells[0].Text.ToString().Trim()); Mct.BookCategory = ((TextBox)(this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text; Bll.CategoryTable Bct = new Bll.CategoryTable(); Bct.update(Mct, Mct.ID); this.GridView1.EditIndex = -1; this.bind(); }
private void SetDrop() { Bll.PressTable press = new Bll.PressTable(); DropDownList1.DataSource = press.aselect(""); DropDownList1.DataValueField = "PreName"; DropDownList1.DataBind(); Bll.CategoryTable cate = new Bll.CategoryTable(); DropDownList2.DataSource = cate.aselect(""); DropDownList2.DataValueField = "BookCategory"; DropDownList2.DataBind(); }
protected void Button1_Click(object sender, EventArgs e) { try { Mct.BookCategory = txtCategory.Text; Bll.CategoryTable Bct = new Bll.CategoryTable(); Bct.insert(Mct); this.bind(); } catch { Response.Write("<script>alert('添加失败!')</script>"); } }
public SqlDataReader bbbang() { Bll.CategoryTable cate = new Bll.CategoryTable(); return(cate.aselect("")); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Bll.CategoryTable Bct = new Bll.CategoryTable(); Bct.delete(int.Parse(this.GridView1.DataKeys[e.RowIndex].Value.ToString())); this.bind(); }