为什么我的按钮需要点击两次才执行事件?
一个分页的跳转按钮,第一次点击只执行PAGE_LOAD,点第二次才执行事件.
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
System.Data.DataTable allList = (new BLL.Item()).ViewItemList(1).Tables[0];
PagedDataSource objPage=new PagedDataSource();//创建分页类
objPage.DataSource=allList.DefaultView ;//设置数据源
objPage.AllowPaging=true;
objPage.PageSize=5;
if(Request.QueryString[ "Page "]!=null)
{
CurPage=Convert.ToInt32(Request.QueryString[ "Page "]);
CurPage=Math.Min(CurPage,objPage.PageCount);
CurPage=Math.Max(CurPage,1);
}
else
CurPage=1;
objPage.CurrentPageIndex=CurPage-1;
TotalPage=objPage.PageCount;
Tnum=objPage.DataSourceCount;
EachPage=objPage.Count;
lblCurPage.Text= "第 "+CurPage.ToString()+ " / "+TotalPage.ToString()+ " 页 ";
lblTnum.Text= "共: