日期:2014-05-17 浏览次数:20452 次
private void SetLinkButton() { btnFirst.Enabled = true; btnPrev.Enabled = true; btnNext.Enabled = true; btnLast.Enabled = true; if (txtPageIndex.Text == "1") { btnFirst.Enabled = false; btnPrev.Enabled = false; } Maticsoft.BLL.Products pBll = new Maticsoft.BLL.Products(); if (txtPageIndex.Text == pBll.GetPagedListCount(int.Parse(txtPageSize.Text), string.Empty).ToString()) { btnNext.Enabled = false; btnLast.Enabled = false; } }
------解决方案--------------------
给你一段代码自己模仿改一下。
public void dataBindhypertensionhome()
{
PagedDataSource pds = new PagedDataSource();
pds.DataSource = B_hypertension.getHypertensionhome();
pds.AllowPaging = true;
pds.PageSize = 1;
int currentIndex = Convert.ToInt32(this.lbl_currentpage.Text) - 1;
pds.CurrentPageIndex = currentIndex;
if (currentIndex == 0)
{
this.lbt_previouspage.Enabled = false;
}
else
{
this.lbt_previouspage.Enabled = true;
}
if (currentIndex == pds.PageCount - 1)
{
this.lbt_nextpage.Enabled = false;
}
else
{
this.lbt_nextpage.Enabled = true;
}
this.lbl_totalpage.Text = pds.PageCount.ToString();
this.DataList1.DataSource = pds;
this.DataList1.DataBind();
}