protected void Page_Load(object sender, EventArgs e)
        {
            PostingCRUD postingCrud = new PostingCRUD();
            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                postings.TotalRows = postingCrud.GetList().Count;
            }
            else
            {
                postings.TotalRows = postingCrud.GetList().Where(x=>x.Show==true).Count();
            }
            if (postings.TotalRows > 3)
            {
                int pagesCount = (int)Math.Ceiling((double)postings.TotalRows / postings.RowsPerPage);
                List<string> pages = new List<string>();
                if (PageNumber > 4)
                {
                    pages.Add("1");
                    pages.Add("..");
                }
                else
                {
                    pages.Add("1");
                }
                for (int i = 2; i < pagesCount; i++)
                {
                    if (i <= (PageNumber + 2) && i >= (PageNumber - 2))
                    {
                        pages.Add(i.ToString());
                    }
                }
                if (PageNumber < pagesCount - 3)
                {
                    pages.Add("..");
                    pages.Add(pagesCount.ToString());
                }
                else
                {
                    pages.Add(pagesCount.ToString());
                }
                rptPager.DataSource = pages;
                rptPager.DataBind();

                if (PageNumber > 1)
                {
                    lnkPrev.NavigateUrl = string.Format("../Postings.aspx?Page={0}", PageNumber - 1);
                    lnkPrev.Visible = true;
                }
                if (PageNumber < pagesCount)
                {
                    lnkNext.NavigateUrl = string.Format("~/Postings.aspx?Page={0}", PageNumber + 1);
                    lnkNext.Visible = true;
                }
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!User.Identity.IsAuthenticated)
     {
         PostingCRUD postingCrud = new PostingCRUD();
         List<Posting> postings = postingCrud.GetList()
             .Where(x => x.Show == true)
             .OrderByDescending(x => x.PostedDate)
             .Skip((PageNumber - 1) * RowsPerPage)
             .Take(RowsPerPage)
             .ToList();
         rptData.DataSource = postings;
         rptData.DataBind();
     }
     else
     {
         cntrlPostings.Visible = false;
         PostingCRUD postingCrud = new PostingCRUD();
         List<Posting> postings = postingCrud.GetList()
             .OrderByDescending(x => x.PostedDate)
             .Skip((PageNumber - 1) * RowsPerPage)
             .Take(RowsPerPage)
             .ToList();
         rptData.DataSource = postings;
         rptData.DataBind();
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     PostingCRUD postingsCrud = new PostingCRUD();
     List<Posting> postings = postingsCrud.GetList();
     rptPostings.DataSource = postings;
     rptPostings.DataBind();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            PostingCRUD postingCrud = new PostingCRUD();
                postings = postingCrud.GetList()
                .Where(x => x.Show == true)
                .OrderByDescending(x => x.PostedDate)
                .ToList();
                postings = GetEveryThirdPosting(postings);
                rptData.DataSource = postings;
            rptData.DataBind();

            FillScrollingString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            PostingCRUD postingCrud = new PostingCRUD();
            if (!IsPostBack && PageID != 0)
            {
                Posting postings = postingCrud.GetList()
                    .Where(x => x.Id == PageID)
                    .FirstOrDefault();

                txtUserName.Text = postings.UserName;
                txtDescription.Text = postings.Description;
                checkShow.Checked = postings.Show;
            }

            if (DeleteID != 0)
            {
                postingCrud.Delete(DeleteID);
                Response.Redirect("~/Postings.aspx");
            }
        }