public void ShowLatestNews() { strPageNo = Request["PageNo"]; try { PageNo = Convert.ToInt32(strPageNo); if (PageNo == 0) { PageNo = 1; } if (PageNo > 50) { PageNo = 50; } BOLNews NewsBOL = new BOLNews(); IQueryable <vLatestNews> ItemList = NewsBOL.GetLatestNews(_pageSize, PageNo); int ResultCount = NewsBOL.GetLatestNewsCount(); rptNewsList.DataSource = ItemList; rptNewsList.DataBind(); int PageCount = ResultCount / _pageSize; if (ResultCount % _pageSize > 0) { PageCount++; } pgrToolbar.PageNo = PageNo; pgrToolbar.PageCount = PageCount; pgrToolbar.ConcatUrl = ConcatUrl; pgrToolbar.PageBind(); } catch { } }