分享一个asp.net pager分页控件

2020-05-23 06:12:36易采站长站整理

}
.number
{
margin: 2px;
color:#0000FF;
text-decoration:underline;
}
.selected
{
margin: 2px;
color: #FF0000;
font-weight: bold;
}

html:

<!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>
<title>分页控件示例</title>
<link href=”CSS/JPager.css” rel=”stylesheet” type=”text/css” />
<script src=”JS/jquery.min.js” type=”text/javascript”></script>
<script src=”JExtension/JPager.js” type=”text/javascript”></script>
<script type=”text/javascript”>
$(function () {
$(“#pager”).JPager({ customer:{template:”%cuRRent%”},count: 10, action: { url: “Service/JService.svc/GetPersons”, data: ‘{“name”:”zhoulq”}’}, showNumber: true },1,5);
});
</script>
</head>
<body>
<table>
</table>
<div id=”pager”></div>
</body>
</html>

wcf:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
namespace JPlugin
{
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class JService
{
[OperationContract]
[WebInvoke]
public PageObject<Person> GetPersons(string name,int pageIndex,int paseSize)
{
return new PageObject<Person>(){RecordCount = 23,SearchResult = new List<Person>(){new Person(){Name=”zhpulq”,Age = 28},new Person(){Name = “zhouxy”,Age = 24}}};
}
}
public class PageObject<T>
{
public int RecordCount { get; set; }
public List<T> SearchResult { get; set; }
}
}