<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebTest2008.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <script src="https://www.jb51.net/js/testJs.js" type="text/javascript"></script> <style type="text/css"> A:link { color: #003399; text-decoration: none; } A:visited { color: #003366; text-decoration: none; } A:hover { color: #ff0000; text-decoration: underline; } A:active { color: #00ff00; text-decoration: none; } </style> <title></title> </head> <body> <form runat="server"> <div> <div> 第1页</div> <table cellspacing="0"> <tr> </tr> </table> </div> </form> </body> </html>
Default.aspx.cs:
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebTest2008 { public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } }
AjaxOperations.aspx:
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AjaxOperations.aspx.cs" Inherits="WebTest2008.AjaxOperations" %>
AjaxOperations.aspx.cs:
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace WebTest2008 { public partial class AjaxOperations : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["pgNumber"])) { //int pgNum = Convert.ToInt32(Request["pgNumber"]); Response.Write("第" + Request["pgNumber"] + "页"); } } } }
Ok了,在我的机器上(vs2008)测试通过,简单的ajax分页效果就实现了。