62,054
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Text.RegularExpressions;
using System.Web.UI;
/// <summary>
///PagerControl 的摘要说明
/// </summary>
namespace YSMV.Control
{
public class UrlRewritePagerControl : System.Web.UI.UserControl
{
#region Parmeter
private string rx;
private Regex reg;
private int _pageSize = 10, _pageCount, _pageIndex = 1, _totalCount = 0, _groupNum = 5;
private string sendToUrl, queryPage = "page", _matchFirst = "$1", _matchLast = "$2", _link = "";
private bool _smart = false;
#endregion
#region HTML
private const string divstart = "<div class='digg'>";
private const string divend = "</div>";
private const string prepage = "<span class='disabled'>";
private const string nextpage = "<span class='disabled'>";
private const string currentpage = "<span class='current'>";
private const string endspan = "</span>";
private const string astart = "<a href='";
private const string ahrefend = "' title='";
private const string aaltend = "'>";
private const string aover = "</a>";
private const string prev = "<";
private const string next = ">";
#endregion
#region Properties
//记录总数
public int TotalCount
{
set { _totalCount = value; }
}
//当前页
public int PageCount
{
set { _pageCount = value; }
get { return _pageCount; }
}
//一页的记录数
public int PageSize
{
get { return _pageSize; }
set { _pageSize = value; }
}
//匹配正则
public string RX
{
get { return rx; }
set { rx = value; }
}
//匹配的Url开始部分
public string MatchLast
{
set { _matchLast = value; }
get { return _matchLast; }
}
//匹配的Url结束部分
public string MatchFirst
{
set { _matchFirst = value; }
get { return _matchFirst; }
}
public int GroupNum
{
get { return _groupNum; }
set { _groupNum = value; }
}
public string Link
{
get { return _link; }
set { _link = value; }
}
public bool Smart
{
get { return _smart; }
set { _smart = value; }
}
#endregion
public UrlRewritePagerControl()
{
sendToUrl = Context.Request.RawUrl;
if (Context.Request[queryPage] != null)
{
int.TryParse(Context.Request[queryPage].ToString(), out _pageIndex);
}
}