/// <summary> /// 查询指定页数的数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnFind_Click(object sender, EventArgs e) { if (txtPage.Text.Trim() == "") { untCommon.InfoMsg("请输入所要查询的页数。"); return; } try { curPage = int.Parse(this.txtPage.Text); } catch (FormatException) { untCommon.InfoMsg("所要查询的页数请输入数字。"); return; } if (curPage > TotalPage || curPage < 1) { untCommon.InfoMsg("没有您所要查询的页数。"); return; } DataTable dat = FixMgr.getLogList((curPage - 1) * pageCount, pageCount, _departId, _power); if (dat != null) { //绑定数据 dbgFix.DataSource = dat.DefaultView; } this.lblCurPage.Text = "第" + curPage.ToString() + "页"; }
/// <summary> /// 刷新数据 /// </summary> private void DataRefresh() { DataTable dat = FixMgr.getLogList((curPage - 1) * pageCount, pageCount, _departId, _power); if (dat != null) { TotalPage = this.getTotalPage();//得到数据的总页数 //绑定数据 dbgFix.DataSource = dat.DefaultView; } this.lblTotalpage.Text = "共" + TotalPage.ToString() + "页"; this.lblCurPage.Text = "第" + curPage.ToString() + "页"; }
private void frmFixLook_Load(object sender, EventArgs e) { curPage = 1; DataTable dat = FixMgr.getLogList(0, pageCount, _departId, _power); if (dat != null) { dbgFix.DataSource = dat.DefaultView; AvailableColumns.Clear(); foreach (DataGridViewColumn c in dbgFix.Columns) { if (!c.Visible) { continue; } AvailableColumns.Add(c.HeaderText); SelectedColumns.Add(c.HeaderText); } dbgFix.ScrollBars = ScrollBars.Both; this.dbgFrozen(); } TotalPage = this.getTotalPage();//得到数据的总页数 this.lblTotalpage.Text = "共" + TotalPage.ToString() + "页"; }