public void LoadData() { string where = " Loai=1 and (Trangthai_Xoa=0 or Trangthai_Xoa is null) and NguoiTao=" + _user.UserID; if (!String.IsNullOrEmpty(txtSearch_UserName.Text.Trim())) { where += "AND " + string.Format(" Ten_Dangnhap like N'%{0}%'", UltilFunc.SqlFormatText(this.txtSearch_UserName.Text.Trim())); } if (!String.IsNullOrEmpty(txt_userfullname.Text.Trim())) { where += "AND " + string.Format(" TenDaydu like N'%{0}%'", UltilFunc.SqlFormatText(this.txt_userfullname.Text.Trim())); } pages.PageSize = 1000; HPCBusinessLogic.NguoidungDAL _NguoidungDAL = new HPCBusinessLogic.NguoidungDAL(); DataSet _ds; _ds = _NguoidungDAL.BindGridT_Nguoidung(pages.PageIndex, pages.PageSize, where); int TotalRecords = Convert.ToInt32(_ds.Tables[1].Rows[0].ItemArray[0].ToString()); int TotalRecord = Convert.ToInt32(_ds.Tables[0].Rows.Count); if (TotalRecord == 0) { _ds = _NguoidungDAL.BindGridT_Nguoidung(pages.PageIndex - 1, pages.PageSize, where); } DataGridCTV.DataSource = _ds; DataGridCTV.DataBind(); pages.TotalRecords = currentPage.TotalRecords = TotalRecords; currentPage.TotalPages = pages.CalculateTotalPages(); currentPage.PageIndex = pages.PageIndex; }