Пример #1
0
        public void Search1()
        {
            string Str_Search = GetSQLSearch();

            if (!string.IsNullOrEmpty(Str_Search))
            {
                pages.PageSize = Global.MembersPerPage;
                HPCBusinessLogic.DAL.T_NewsDAL _T_newsDAL = new HPCBusinessLogic.DAL.T_NewsDAL();
                DataSet _ds;
                _ds = _T_newsDAL.Search_All_News(pages.PageIndex, pages.PageSize, Str_Search);
                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 = _T_newsDAL.Search_All_News(pages.PageIndex - 1, pages.PageSize, Str_Search);
                }
                dgr_tintuc.DataSource = _ds;
                dgr_tintuc.DataBind();
                pages.TotalRecords      = CurrentPage2.TotalRecords = TotalRecords;
                CurrentPage2.TotalPages = pages.CalculateTotalPages();
                CurrentPage2.PageIndex  = pages.PageIndex;
            }
            else
            {
                System.Web.UI.ScriptManager.RegisterStartupScript(this, typeof(string), "Message", "alert('Trường ngày tháng phải nhập đúng theo định dang dd/MM/yyyy!');", true);
            }
        }