private void Refresh(int pageIndex) { if (_contactSrc == null) { _contactSrc = (ComService.ServiceModels.Contact)ViewState["contact"]; } PagedDataSource pds = new PagedDataSource(); pds.DataSource = _contactSrc.Linkmans; pds.AllowPaging = true; pds.PageSize = listLinkMan.RepeatColumns * 5; pageIndex = pageIndex < 0 ? 0 : pageIndex; pageIndex = pageIndex >= pds.PageCount ? pds.PageCount - 1 : pageIndex; pds.CurrentPageIndex = pageIndex; lbtPrevPage.Enabled = !pds.IsFirstPage; lbtNextPage.Enabled = !pds.IsLastPage; listLinkMan.DataSource = pds; listLinkMan.DataBind(); if (IsCompany) { foreach (DataListItem dl in listLinkMan.Items) { ImageButton button = (ImageButton)dl.FindControl("Btndelete"); button.Visible = false; button.Enabled = false; } } tbPage.Style["display"] = (lbtPrevPage.Enabled || lbtNextPage.Enabled) ? "block" : "none"; }
protected void Page_Load(object sender, EventArgs e) { if (_contactSrc == null && Visible) { _contactSrc = (ComService.ServiceModels.Contact)ViewState["contact"]; } if (ViewState["pageindex"] == null) { CurrPageIndex = 0; } }