//根据合同负责人查询 public void FindByChargePerson() { try { ViewState["page"] = 5; List <Common.Entities.Pact> list = BLLPact.FindByChargePerson(tCondition.Text.Trim(), Convert.ToInt32(Session["SecrecyLevel"])); Grid_Pact.RecordCount = list.Count(); Grid_Pact.DataSource = list; Grid_Pact.DataBind(); btnDelete.Enabled = false; } catch (Exception ex) { publicMethod.SaveError(ex, this.Request); } }
//全选按钮 protected void btnSelect_All_Click(object sender, EventArgs e) { Grid_Pact.SelectAllRows(); int[] select = Grid_Pact.SelectedRowIndexArray; int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_Pact.RecordCount / this.Grid_Pact.PageSize)); if (Grid_Pact.PageIndex == Pages) { m = (Grid_Pact.RecordCount - this.Grid_Pact.PageSize * Grid_Pact.PageIndex); } else { m = this.Grid_Pact.PageSize; } bool isCheck = false; for (int i = 0; i < m; i++) { if (BoxSelect_Pact.GetCheckedState(i) == false) { isCheck = true; } } if (isCheck) { foreach (int item in select) { BoxSelect_Pact.SetCheckedState(item, true); } btnDelete.Enabled = true; btnSelect_All.Text = "取消全选"; } else { foreach (int item in select) { BoxSelect_Pact.SetCheckedState(item, false); } btnDelete.Enabled = false; btnSelect_All.Text = "全选"; } }