Default.aspx:
<%@ 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="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 onload="showPages(1, 10, 100)">
<form id="form1" runat="server">
<div>
<div style="text-align: center" id="tbTest">
第1页</div>
<table cellspacing="0" style="width: 100%; height: 30px" border="0" align="center">
<tr id="trPager">
</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分页效果就实现了。
希望本文所述对大家ajax程序设计有所帮助。









