日期:2014-05-17 浏览次数:20454 次
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;
namespace B2B.UC
{
public partial class UCPaged : System.Web.UI.UserControl
{
#region 属性组
/// <summary>
/// 源数据源
/// </summary>
private ArrayList objAL;
public ArrayList ObjAL
{
get { return objAL; }
set { objAL = value; }
}
/// <summary>
/// 源数据控件
/// </summary>
private DataList objDl;
public DataList ObjDl
{
get { return objDl; }
set { objDl = value; }
}
/// <summary>
/// 源页面
/// </summary>
private string pageName;
public string PageName
{
get { return pageName; }
set { pageName = value; }
}
/// <summary>
/// url参数哈希表
/// </summary>
private Hashtable parmHt;
public Hashtable ParmHt
{
get { return parmHt; }
set { parmHt = value; }
}
/// <summary>
/// 每页显示数
/// </summary>
private int pageSize;
public int PageSize
{
get
{
if (pageSize == null && pageSize <= 0)
{
return 10;
}
else
{
return pageSize;
}
}
set { pageSize = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
bindPagedData(objAL, objDl);
}
/// <summary>
/// 获得分页url参数和源页面
/// </summary>
/// <param name="sourceHT"> </param>
/// <returns> </returns>
private StringBuilder getParmHT(Hashtable sourceHT)
{
StringBuilder parmStr = new StringBuilder();
parmStr = parmStr.Append(pageName);
parmStr = parmStr.Append("?");
if (sourceHT != null && sourceHT.Count > 0)
{
foreach (Dic