//分页按钮点击事件
protected void lnkbtnOnes_Click(object sender, EventArgs e)
{
this.labPages.Text = "1";
BindDataSearch();
this.dlistAnswered.Visible = false;
}
protected void lnkbtnUps_Click(object sender, EventArgs e)
{
this.labPages.Text = Convert.ToString(Convert.ToInt32(this.labPages.Text) - 1);
BindDataSearch();
this.dlistAnswered.Visible = false;
}
protected void lnkbtnNexts_Click(object sender, EventArgs e)
{
this.labPages.Text = Convert.ToString(Convert.ToInt32(this.labPages.Text) + 1);
BindDataSearch();
this.dlistAnswered.Visible = false;
}
protected void lnkbtnBacks_Click(object sender, EventArgs e)
{
this.labPages.Text = this.labBackPages.Text;
BindDataSearch();
this.dlistAnswered.Visible = false;
}
PagedDataSource pds = new PagedDataSource();
public void BindSortData()
{
Model.Counseling CSL = new Model.Counseling();
BLL.CounselingBLL BLL = new BLL.CounselingBLL();
CSL.uid = Convert.ToInt32(uid);
pds.DataSource = BLL.ShowDisease(CSL).DefaultView;
//pds属性设置]
int curpage = Convert.ToInt32(this.labPage.Text);
pds.AllowPaging = true;
pds.PageSize = 5; //每页显示大小
pds.CurrentPageIndex = curpage - 1; //取得当前页的页码
this.lnkbtnUp.Enabled = true;
this.lnkbtnNext.Enabled = true;
this.lnkbtnBack.Enabled = true;
this.lnkbtnOne.Enabled = true;
if (curpage == 1)
{
this.lnkbtnOne.Enabled = false;//不显示第一页按钮
this.lnkbtnUp.Enabled = false;//不显示上一页按钮
}
if (curpage == pds.PageCount)
{
this.lnkbtnNext.Enabled = false;//不显示下一页
this.lnkbtnBack.Enabled = false;//不显示最后一页
}
this.labBackPage.Text = Convert.ToString(pds.PageCount);
//绑定呈现控件
this.gvSort.DataSource = pds;
this.gvSort.DataBind();
}
//自定义指定页
public void ddlDate()
{
for (int i = 1; i <= pds.PageCount; i++)
{
ListItem item = new ListItem();
item.Text = i.ToString();
item.Value = i.ToString();
this.ddlpages.Items.Add(item);
}
}