private void LoadData() { string where = "1=1 "; if (ddlTenTruyCap.SelectedIndex > 0) { where += " And User_ID = " + ddlTenTruyCap.SelectedValue + " "; } if (ddlTraCuu.SelectedIndex > 0) { where += " And Type = " + ddlTraCuu.SelectedValue + " "; } if (txt_FromDate.Text != "" && txt_ToDate.Text != "") { where += " and DateCreated>='" + txt_FromDate.Text + " 00:00:59' and DateCreated<='" + txt_ToDate.Text + " 23:59:59'"; } where += " Order by DateCreated DESC"; pages.PageSize = Global.MembersPerPage; UltilFunc _DAL = new UltilFunc(); DataSet _ds = _DAL.BindGridT_HistorySource(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 = _DAL.BindGridT_HistorySource(pages.PageIndex - 1, pages.PageSize, where); } gdListActionHistorys.DataSource = _ds; gdListActionHistorys.DataBind(); _ds.Clear(); pages.TotalRecords = curentPages.TotalRecords = TotalRecords; curentPages.TotalPages = pages.CalculateTotalPages(); curentPages.PageIndex = pages.PageIndex; }