日期:2014-05-18 浏览次数:20467 次
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdateMain" runat="server"> <ContentTemplate> <asp:Label ID="lblPageCount" runat="server" Text=""></asp:Label> <asp:Button ID="btnPre" runat="server" Text="上一页" onclick="btnPre_Click" /> <asp:Button ID="btnNext" runat="server" Text="下一页" onclick="btnNext_Click" /> <a href="Default13.aspx">13页</a> </ContentTemplate> </asp:UpdatePanel> </form> </body> </html>
using System; using System.Collections; using System.Data; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class CRMMember_Default11 : System.Web.UI.Page { public Int32 MyPageIndex { get { return (ViewState["MyPageIndex"] == null || Convert.ToInt32(ViewState["MyPageIndex"]) < 1) ? 1 : Convert.ToInt32(ViewState["MyPageIndex"]); } set { ViewState["MyPageIndex"] = value; } } protected void Page_Load(object sender, EventArgs e) { BindList(); } void BindList() { lblPageCount.Text = MyPageIndex.ToString(); } protected void btnPre_Click(object sender, EventArgs e) { MyPageIndex -= 1; BindList(); } protected void btnNext_Click(object sender, EventArgs e) { MyPageIndex += 1; BindList(); } }