protected void lnkGOFPage_Click(object sender, EventArgs e)
        {
            args = new CustomPageChangeArgs();
            switch (((LinkButton)sender).ID)
            {
                case "lnkFirstPage":
                    args.CurrentPageNumber = 1; HttpContext.Current.Items.Add("currentPage", 1);
                    break;
                case "lnkPreviousPage":
                    args.CurrentPageNumber = Convert.ToInt32(lblCurrentPage.Text) - 1;
                    break;
                case "lnkNextPage":
                    args.CurrentPageNumber = Convert.ToInt32(lblCurrentPage.Text) + 1;
                    break;
                case "lnkLastPage":
                    args.CurrentPageNumber = Convert.ToInt32(lblTotalRecords.Text);
                    break;
            }

            this.CurrentPageNumber = args.CurrentPageNumber;
            Pager_PageChanged(this, args);

            BindRepeater();
            lblCurrentPage.Text = this.CurrentPageNumber.ToString();
            SetUnsetLinkButtons();
        }
        protected void custPager_PageChanged(object sender, CustomPageChangeArgs e)
        {

            this.GridViewUsers.PageSize = e.CurrentPageSize;
            this.GridViewUsers.PageIndex = e.CurrentPageNumber-1;

            int totalPages = this.users.All().Count();
            custPager.TotalPages = totalPages % GridViewUsers.PageSize == 0 ? totalPages / GridViewUsers.PageSize : totalPages / GridViewUsers.PageSize + 1;
        }
        protected void ddlPageNumber_SelectedIndexChanged(object sender, EventArgs e)
        {
            CustomPageChangeArgs args = new CustomPageChangeArgs();
            args.CurrentPageSize = Convert.ToInt32(this.ddlPageSize.SelectedItem.Value);
            args.CurrentPageNumber = Convert.ToInt32(this.ddlPageNumber.SelectedItem.Text);
            args.TotalPages = Convert.ToInt32(this.lblShowRecords.Text);
            Pager_PageChanged(this, args);

            lblShowRecords.Text = string.Format(" {0} ", args.TotalPages.ToString());
        }
        protected void lnkPageNumbers_Click(object sender, EventArgs e)
        {
            args = new CustomPageChangeArgs();
            args.CurrentPageNumber = Convert.ToInt32(((LinkButton)sender).Text);
            this.CurrentPageNumber = args.CurrentPageNumber;
            Pager_PageChanged(this, args);

            BindRepeater();
            lblCurrentPage.Text = this.CurrentPageNumber.ToString();
            SetUnsetLinkButtons();
        }
        protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
        {
            CustomPageChangeArgs args = new CustomPageChangeArgs();
            args.CurrentPageSize = Convert.ToInt32(this.ddlPageSize.SelectedItem.Value);
            args.CurrentPageNumber = 1;
            args.TotalPages = Convert.ToInt32(this.lblShowRecords.Text);
            Pager_PageChanged(this, args);

            ddlPageNumber.Items.Clear();
            for (int count = 1; count <= this.TotalPages; ++count)
                ddlPageNumber.Items.Add(count.ToString());
            ddlPageNumber.Items[0].Selected = true;
            lblShowRecords.Text = string.Format(" {0} ", this.TotalPages.ToString());
        }
 void Pager_PageChanged(object sender, CustomPageChangeArgs e)
 {
     PageChanged(this, e);
 }