private void loadEducation() { Education = new DataTable(); Education.Columns.Add("Achievement"); Education.Columns.Add("Institute"); Education.Columns.Add("Year"); GridEducation.DataSource = EmergencyContact; GridEducation.DataBind(); }
private void LoadEducation() { int id = GetQueryIntValue("id"); IQueryable <Infobasis.Data.DataEntity.EmployeeEducation> q = DB.EmployeeEducations; q = q.Where(item => item.UserID == id); // 在查询添加之后,排序和分页之前获取总记录数 GridEducation.RecordCount = q.Count(); // 排列和数据库分页 q = SortAndPage <Infobasis.Data.DataEntity.EmployeeEducation>(q, GridEducation); GridEducation.DataSource = q; GridEducation.DataBind(); }
//全选按钮 protected void btnSelect_All_Click(object sender, EventArgs e) { GridEducation.SelectAllRows(); int[] select = GridEducation.SelectedRowIndexArray; int m; //取整数(不是四舍五入,全舍) int Pages = (int)Math.Floor(Convert.ToDouble(GridEducation.RecordCount / this.GridEducation.PageSize)); if (GridEducation.PageIndex == Pages) { m = (GridEducation.RecordCount - this.GridEducation.PageSize * GridEducation.PageIndex); } else { m = this.GridEducation.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 = "全选"; } }