if (!Page.IsPostBack) {
databind(\* from tbluser order by userID desc\); } }
protected void Button5_Click(object sender, EventArgs e) {
for (int i = 0; i < GridView1.Rows.Count; i++) {
CheckBox cb =
(CheckBox)GridView1.Rows[i].FindControl(\); //在当前搜寻当前控件
if (cb.Checked) {
int id =
int.Parse(GridView1.DataKeys[i].Value.ToString()); //获取一个控件值
string sqlstr = \where userID=\ + id + \;
Class1.ExecSql(sqlstr);
}
17
}
databind(\); }
public void databind(string sql) {
GridView1.DataSource = Class1.ExecSel(sql); GridView1.DataBind(); }
protected void Button6_Click(object sender, EventArgs e) {
for (int i = 0; i < GridView1.Rows.Count; i++) {
CheckBox cb =
(CheckBox)GridView1.Rows[i].FindControl(\); //在当前搜寻当前控件
if (cb.Checked) {
int id =
int.Parse(GridView1.DataKeys[i].Value.ToString()); //获取一个控件值
18
string sqlstr = \where userID=\ + id + \;
Class1.ExecSql(sqlstr);
}
}
databind(\); }
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) {
GridView1.PageIndex = e.NewPageIndex; databind(\); }
protected void Button4_Click(object sender, EventArgs e) {
string findname;
findname = \ + TextBox1.Text + \; databind(findname); }
19
protected void Button2_Click(object sender, EventArgs e) {
for (int i = 0; i < GridView1.Rows.Count; i++) {
CheckBox cb =
(CheckBox)GridView1.Rows[i].FindControl(\); //在当前搜寻当前控件
if (cb.Checked) {
int id =
int.Parse(GridView1.DataKeys[i].Value.ToString()); //获取一个控件值
string sqlstr = \from tbluser where userID=\ + id + \;
Class1.ExecSql(sqlstr); } }
databind(\); } }
20