protected void btndel_Click(object sender, EventArgs e) { int i = 0; string sysID = string.Empty; NCPEP.Bll.T_Wztou bll = new NCPEP.Bll.T_Wztou(); foreach (RepeaterItem row in this.rep.Items) { if (row.ItemType == ListItemType.Item || row.ItemType == ListItemType.AlternatingItem) { CheckBox chk = (CheckBox)row.FindControl("cbx"); Label lbid = (Label)row.FindControl("lbid"); if (chk.Checked) { i++; sysID = lbid.Text; bll.Delete(int.Parse(sysID)); } } } if (i == 0) { MessageBox.Show(this, "请选择需要删除的项!"); } else { MessageBox.Show(this, "已成功删除所选项!"); BindDate(); } }
/// <summary> /// 初始绑定数据 /// </summary> private void BindDate() { StringBuilder sb = new StringBuilder(); sb.Append(" 1=1"); NCPEP.Bll.T_Wztou bll = new NCPEP.Bll.T_Wztou(); this.pg.RecordCount = bll.GetRecordCount(sb.ToString()); this.pg.PageSize = 12; this.pg.UrlPageIndexName = "pg"; if (!string.IsNullOrEmpty(hdpage.Value) && hdpage.Value != "1") { pg.CurrentPageIndex = int.Parse(hdpage.Value); } int sindex = (this.pg.CurrentPageIndex - 1) * this.pg.PageSize + 1; int eindex = this.pg.CurrentPageIndex * this.pg.PageSize; DataSet ds = bll.GetListByPage(sb.ToString(), "id desc", sindex, eindex); //DataSet ds = bll.GetList(this.AspNetPager1.PageSize, this.AspNetPager1.CurrentPageIndex, sb.ToString()); this.rep.DataSource = ds; this.rep.DataBind(); }