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
复制代码 代码如下:
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
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>