asp.net Repeater之非常好的数据分页

来源:不详 责任编辑:栏目编辑 发表时间:2013-07-01 06:07 点击:
分页控件源代码如下:
复制代码 代码如下:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
#region Assembly Resource Attribute
[assembly: System.Web.UI.WebResource("WebControlLibrary.Js.AjaxHelper.js", "text/javascript")]
[assembly: System.Web.UI.WebResource("WebControlLibrary.img.bg_pager.png", "image/gif")]
#endregion
namespace WebControlLibrary
{
/// <summary>
/// Repeater分页控件可进行Ajax分页(但Ajax分页不能传参数)
/// </summary>
[DefaultProperty("Text")]
[ToolboxData("<{0}:RepeaterPages runat=server></{0}:RepeaterPages>")]
public class RepeaterPages : WebControlLibrary.Repeater
{
// <summary>
/// 构造函数
/// </summary>
public RepeaterPages()
: base()
{
}
/// <summary>
/// 下一页分页文本内容
/// </summary>
private string _NextPage = ">";
/// <summary>
/// 下一页标记
/// </summary>
[Bindable(false), Description("下一页标记所显示的文本内容")]
public string NextPage
{
get { return _NextPage; }
set { _NextPage = value; }
}
/// <summary>
/// 下一页标记
/// </summary>
private string _LastPage = "<";
/// <summary>
/// 上一页标记
/// </summary>
[Bindable(false), Description("上一页标记所显示的文本内容")]
public string LastPage
{
get { return _LastPage; }
set { _LastPage = value; }
}
/// <summary>
/// 总记录数属性
/// </summary>
private int _RecordCount;
/// <summary>
/// 页面分页大小属性
/// </summary>
private int _PageSize;
/// <summary>
/// 当前页数
/// </summary>
private int _CurrentPage;
/// <summary>
/// 返回总页面
/// </summary>
private int _AllPages;
/// <summary>
/// 页面地址
/// </summary>
private string _Url;
/// <summary>
/// 传入Sql语句
/// </summary>
private string _SqlString;
/// <summary>
/// 每页显示页码数
/// </summary>
private int _PageNumberCount;
/// <summary>
/// 数据库中显示的字段列表
/// </summary>
private string _ShowTableCollName;
/// <summary>
/// 记录数属性
/// </summary>
[Bindable(true), Category("Appearance"), DefaultValue("0")]
private int RecordCount
{
get
{
int IntTempValue = 0;
if (Int32.TryParse(Sql_Function.SqlDb.RecordCounts(SqlString), out IntTempValue))
return IntTempValue;
else
return 0;
}
set
{
_RecordCount = value;
}
}
/// <summary>
/// 每页分页大小属性
/// </summary>
[Bindable(true), Category("Appearance"), DefaultValue("50"), Description("每页分页大小属性")]
public int PageSize
{
get
{
if (_PageSize == 0 || _PageSize.ToString() == "" || _PageSize > 200)
{
return 50;
}
else if (Sql_Function.PublicFunction.isNumber(_PageSize.ToString()))
{
return 50;
}
else if (_PageSize <= 0)
{
return 50;
}
else if (_PageSize > 200)
{
return 50;
}
else
{
return _PageSize;
}
}
set { _PageSize = value; }
}
/// <summary>
/// 每页显示的页码个数
/// </summary>
[Bindable(true), Category("Appearance"), DefaultValue("5"), Description("每页显示的页码个数")]
public int PageNumberCount
{
get
{
if (_PageNumberCount == 0 || _PageNumberCount.ToString() == "" || _PageNumberCount > 30)
{
return 5;
}
else if (Sql_Function.PublicFunction.isNumber(_PageNumberCount.ToString()))
{
return 5;
}
else if (_PageN

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • 浅析.NET下XML数据访问新机制
      • asp.net 面试+笔试题目第1/2页
      • C# 邮件地址是否合法的验证
      • asp.net 设置GridView的选中行的实现代码
      • C#高级编程:数据库连接[1]
      • 经典C++程序1
      • IIS 自动回收导致后台定时器失效的问题解决
      • ASP.NET&#160;GridView列表代码示例
      • Asp.net MVC源码分析--Action Filter的链式调用
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1