//根据平台名称搜索 public void FindByPlatformName() { try { ViewState["page"] = 1; List <Common.Entities.Platform> list = BLLPlatform.FindPlatformList(TriggerBox.Text.Trim(), Convert.ToInt32(Session["SecrecyLevel"])); Grid_Platform.RecordCount = list.Count(); Grid_Platform.DataSource = list; Grid_Platform.DataBind(); btnDelete.Enabled = false; } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
//根据平台级别查询 public void FindByPlatformType() { try { ViewState["page"] = 2; List <Common.Entities.Platform> list = BLLPlatform.FindPlatformRank(DropDownListPlatformType.SelectedText, Convert.ToInt32(Session["SecrecyLevel"])); Grid_Platform.RecordCount = list.Count(); Grid_Platform.DataSource = list; Grid_Platform.DataBind(); btnDelete.Enabled = false; } catch (Exception ex) { publicmethod.SaveError(ex, this.Request); } }
//全选按钮 protected void btnSelect_All_Click(object sender, EventArgs e) { Grid_Platform.SelectAllRows(); int[] select = Grid_Platform.SelectedRowIndexArray; int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(Grid_Platform.RecordCount / this.Grid_Platform.PageSize)); if (Grid_Platform.PageIndex == Pages) { m = (Grid_Platform.RecordCount - this.Grid_Platform.PageSize * Grid_Platform.PageIndex); } else { m = this.Grid_Platform.PageSize; } bool isCheck = false; for (int i = 0; i < m; i++) { if (CBoxSelect.GetCheckedState(i) == false) { isCheck = true; } } if (isCheck) { foreach (int item in select) { CBoxSelect.SetCheckedState(item, true); } btnDelete.Enabled = true; btnSelect_All.Text = "取消全选"; } else { foreach (int item in select) { CBoxSelect.SetCheckedState(item, false); } btnDelete.Enabled = false; btnSelect_All.Text = "全选"; } }