//NumPerPage -- so dong tren 1 trang public void InitPager(int NumPerPage) { DataTable dt = (DataTable)gridControl.DataSource; PagerInfo page = new PagerInfo(); page.Data = dt; page.NumPerPage = NumPerPage; //Data la DataTable int totalRow = dt.Rows.Count; if (totalRow % NumPerPage == 0) { page.TotalPage = totalRow / NumPerPage; } else { page.TotalPage = totalRow / NumPerPage + 1; } if (dt.Rows.Count == 0) { this.Visible = false; return; } else { this.Visible = true; page.CurrentPage = 1; } lblTongSoDong.Text = totalRow.ToString(); object temp = this.gridControl.Tag; TagPropertyMan.InsertOrUpdate(ref temp, PagerInfo.PAGE_INFO, page); this.gridControl.Tag = temp; ShowCurrentPage(page); }
private void ShowCurrentPage(PagerInfo page) { DataTable tempt = page.GetCurrentPage(); gridControl.DataSource = tempt; //New update for get detail of Ung Vien if (DetailOfFirtsRows != null) DetailOfFirtsRows(HelpNumber.ParseInt64(tempt.Rows[0]["ID"])); //-------------------- //gridView.FocusedRowHandle = 0; textEdit1.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; textEdit1.Text = page.CurrentPage + "/" + page.TotalPage ; textEdit1.Properties.AllowFocused = false; textEdit1.BackColor = Color.White; textEdit1.Update(); if (page.CurrentPage == page.TotalPage) { btnLast.Enabled = false; btnNextPage.Enabled = false; } else { btnLast.Enabled = true; btnNextPage.Enabled = true; } if (page.CurrentPage == 1) { btnFirst.Enabled = false; btnPrevPage.Enabled = false; } else { btnFirst.Enabled = true; btnPrevPage.Enabled = true; } }