ASP.NET之Datalist详解(分页)(8)
来源:未知 责任编辑:责任编辑 发表时间:2015-09-17 09:43 点击:次
TextBox txtPage = e.Item.FindControl("txtPage") as TextBox;
int MyPageNum = 0;
if (!txtPage.Text.Equals(""))
MyPageNum = Convert.ToInt32(txtPage.Text.ToString());
if (MyPageNum <= 0 || MyPageNum > PageCount)
{
Response.Write("<script>alert('请输入页数并确定没有超出总页数!')</script>");
txtPage.Text = "";
}
else
BindDataList(MyPageNum - 1);
}
break;
}
}
protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
//以下六个为得到脚模板中的控件,并创建变量.
Label CurrentPage = e.Item.FindControl("labCurrentPage") as Label;
Label PageCount = e.Item.FindControl("labPageCount") as Label;
LinkButton FirstPage = e.Item.FindControl("lnkbtnFirst") as LinkButton;
LinkButton PrePage = e.Item.FindControl("lnkbtnFront") as LinkButton;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>