internal void LoadMainCats(int MCat) { strPageNo = Request["PageNo"]; try { PageNo = Convert.ToInt32(strPageNo); } catch { } if (PageNo == 0) { PageNo = 1; } BOLNews NewsBOL = new BOLNews(); int SkipCount = (PageNo - 1) * PageSize; var ItemList = NewsBOL.GetMainCatItems(new int[] { }, PageSize, PageNo, MCat).Select(t => new { t.Code, t.Title, t.Priority, t.SoTitr, t.NewsDate, t.Abstract, t.PicFile1 }).Distinct().OrderByDescending(p => p.Priority).Skip(SkipCount).Take(PageSize);; int ResultCount = NewsBOL.GetMainCatItemsCount(MCat); rptNewsList.DataSource = ItemList; rptNewsList.DataBind(); ConcatUrl = "&MCat=" + MCat; int PageCount = ResultCount / _pageSize; if (ResultCount % _pageSize > 0) { PageCount++; } pgrToolbar.PageNo = PageNo; pgrToolbar.PageCount = PageCount; pgrToolbar.ConcatUrl = ConcatUrl; pgrToolbar.PageBind(); }