protected void Button2_Click(object sender, EventArgs e) { Bll.ReadersTable Brt = new Bll.ReadersTable(); this.GridView1.DataSource = Brt.select("ReaCategory='" + txtCategory.Text + "'"); this.GridView1.DataKeyNames = new string[] { "ID" }; this.GridView1.DataBind(); }
public void bind() { Bll.ReadersTable Brt = new Bll.ReadersTable(); this.GridView1.DataSource = Brt.select(""); this.GridView1.DataKeyNames = new string[] { "ID" }; this.GridView1.DataBind(); }
protected void BindList() { Bll.ReadersTable rea = new Bll.ReadersTable(); this.BorTitle.DataSource = rea.select(""); //查询ReadersTable表 this.BorTitle.DataTextField = "ReaCategory"; //设置DropCode绑定的数据项中文本显示的数据列 this.BorTitle.DataValueField = "ID"; //设置DropCode绑定的数据项中的值的数据列 this.BorTitle.DataBind(); //调用DataBind()方法,进行数据绑定 }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Mrt.ID = int.Parse(GridView1.Rows[e.RowIndex].Cells[0].Text.ToString().Trim()); Mrt.ReaCategory = ((TextBox)(this.GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text; Bll.ReadersTable Brt = new Bll.ReadersTable(); Brt.update(Mrt, Mrt.ID); this.GridView1.EditIndex = -1; this.bind(); }
protected void Button1_Click(object sender, EventArgs e) { try { Mrt.ReaCategory = txtCategory.Text; Bll.ReadersTable Brt = new Bll.ReadersTable(); Brt.insert(Mrt); this.bind(); } catch { Response.Write("<script>alert('添加失败!')</script>"); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { Bll.ReadersTable Brt = new Bll.ReadersTable(); Brt.delete(int.Parse(this.GridView1.DataKeys[e.RowIndex].Value.ToString())); this.bind(); }