使用如上方法确实可以实现Ajax分页效果,但我总觉得不够简洁,研究了一下午,终于捣鼓出了点东西O_o
首先创建前台页面MyAjaxPager.aspx
复制代码 代码如下:






.a{}{ height:20px; line-height:20px; border-bottom:1px solid #d8dfea; clear:both;}
.b{}{ float:left; width:30px;}
.c{}{ float:left; width:500px;}



var xmlHttp;
function getData(pIndex) {
xmlHttp = GetXmlRequest();
xmlHttp.onreadystatechange = ShowRepeaterData;
xmlHttp.open(“GET”, “AjaxProcess.aspx?index=” + pIndex, true);
xmlHttp.send(null);
}
function ShowRepeaterData() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
var gridData = xmlHttp.responseText;
var grid = document.getElementById(“grid”);
grid.innerHTML = gridData;
}
}







1
2
3
4
5
50
500
5000
50000
99999


















编号姓名











画面很简单,就是一排index地址,当点击链接后会以ajax的方式将数据绑定到下边的repeater。



主要功能是在处理Ajax请求的AjaxProcess.aspx页面实现的,我们来看看。
12下一页阅读全文