示例#1
0
        public void loadEventlist(int pageSizefromUI)
        {
            int UserId             = Convert.ToInt32(Session["CurrentUserId"]);
            List <UsersModel> list = Logic.ListDisableUser();

            GridViewEvent.DataSource = list;
            GridViewEvent.DataBind();
            if (list.Count != 0)
            {
                int totalRecords = list.Count();
                int pageSize     = pageSizefromUI;
                int totalPages   = totalRecords / pageSize;
                if (totalRecords % pageSize > 0)
                {
                    totalPages += 1;
                }
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < totalPages; i++)
                {
                    int pageNo = i + 1;
                    sb.Append("<a style=\"color: #FFFFFF\" href=\"ViewAdmins.aspx?IssueStartIndex=" + pageSize * i + "\">" + pageNo.ToString() + "</a>&nbsp;");
                    int GridPagingNumber = pageSize * i;
                    Session["GridPagingNumber"] = GridPagingNumber;
                }
                LiteralEvent.Text        = "Page: " + sb.ToString();
                GridViewEvent.DataSource = list.Skip(IssueStartIndex).Take(pageSize);
                GridViewEvent.DataBind();
            }
            else
            {
                lblNoEvents.Text  = "There are no events.";//There are no tasks assigned to you.
                LiteralEvent.Text = " ";
            }
        }
        public void loadEventlist(int pageSizefromUI)
        {
            List <EventsModel> list = Logic.ListEvents();

            GridViewEvent.DataSource = list;
            GridViewEvent.DataBind();

            if (list.Count != 0)
            {
                int totalRecords = list.Count();
                int pageSize     = pageSizefromUI;
                int totalPages   = totalRecords / pageSize;
                if (totalRecords % pageSize > 0)
                {
                    totalPages += 1;
                }
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < totalPages; i++)
                {
                    int pageNo = i + 1;

                    sb.Append("<a style=\"color: #FFFFFF\" href=\"AdminHome.aspx?EventStartIndex=" + pageSize * i + "\">" + pageNo.ToString() + "</a>&nbsp;");
                    int GridPagingNumber = pageSize * i;
                    Session["GridPagingNumber"] = GridPagingNumber;
                }
                LiteralEvent.Text        = "Page: " + sb.ToString();
                GridViewEvent.DataSource = list.Skip(EventStartIndex).Take(pageSize);
                GridViewEvent.DataBind();
            }
            else
            {
                lblNoEvents.Text  = "There are no events.";
                LiteralIssue.Text = " ";
            }
        }
        protected void LoadEvent()
        {
            DataTable dt = new DataTable();

            dt = dal.SelectAllInformation();
            GridViewEvent.DataSource = dt;
            GridViewEvent.DataBind();
        }
 protected void GridViewEvent_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     LoadEvent();
     GridViewEvent.PageIndex = e.NewPageIndex;
     GridViewEvent.DataBind();
 }