gotoPage.Text = (CurrentPage+1).ToString(); //释放SqlDataAdapter MyAdapter.Dispose(); }
#region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.Fistpage.Command += new System.Web.UI.WebControls.CommandEventHandler(this.Page_OnClick); this.Prevpage.Command += new System.Web.UI.WebControls.CommandEventHandler(this.Page_OnClick); this.Nextpage.Command += new System.Web.UI.WebControls.CommandEventHandler(this.Page_OnClick); this.Lastpage.Command += new System.Web.UI.WebControls.CommandEventHandler(this.Page_OnClick); this.gotoPage.TextChanged += new System.EventHandler(this.gotoPage_TextChanged); this.Load += new System.EventHandler(this.Page_Load);
} #endregion //跳页代码 private void gotoPage_TextChanged(object sender, System.EventArgs e) { try { JumpPage = (int)ViewState["JumpPages"];//从ViewState中读取可用页数值保存到JumpPage变量中 //判断用户输入值是否超过可用页数范围值 if(Int32.Parse(gotoPage.Text) > JumpPage Int32.Parse(gotoPage.Text) <= 0)
Response.Write("<script>alert('页码范围越界!');location.href='WebForm8.aspx'</script>"); else { int InputPage = Int32.Parse(gotoPage.Text.ToString()) - 1;//转换用户输入值保存在int型
InputPage变量中
上一篇:让QQ好友的黑名单功能失效
下一篇:在Asp.net中为图像加入版权信息
|