asp.net 无刷新分页实例代码,需要的朋友可以参考一下
数据类代码:
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using System.Reflection;
namespace DAL
{
public class UserManageClass
{
///
///
/// 总页数
public int GetPageCount()
{
int counts;
string SqlStr = “select count(0) from [User]”;
counts = new SQLHelper().Content(SqlStr, CommandType.Text);
return counts;
}
///
///
/// 开始页数
/// 结束页数
/// 每一页的内容
public DataTable GetPageDate(string SatrPage, string EndPage)
{
来源gaodaimacom搞#代%码网 DataTable dt;
string SqlStr = @”select * from
(select *, ROW_NUMBER() over(order by id)as no_ from [User])aa
where aa.no_ between ‘”+SatrPage+”‘ and ‘”+EndPage+”‘”;
dt = new SQLHelper().ExecuteQuery(SqlStr, CommandType.Text);
return dt;
}
///
///
/// 实体对象的类型
/// 要转换的DataTable
///
public List DataTableToEntityList(DataTable dt)
{
List entiyList = new List();
Type entityType = typeof(T);
PropertyInfo[] entityProperties = entityType.GetProperties();
foreach (DataRow row in dt.Rows)
{
T entity = Activator.CreateInstance();
foreach (PropertyInfo propInfo in entityProperties)
{
if (dt.Columns.Contains(propInfo.Name))
{
if (!row.IsNull(propInfo.Name))
{
propInfo.SetValue(entity, row[propInfo.Name], null);
}
}
}
entiyList.Add(entity);
}
return entiyList;
}
}
}
以上就是asp.net 无刷新分页实例代码的详细内容,更多请关注gaodaima搞代码网其它相关文章!