using System;
using System.IO;
using System.Drawing;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.ComponentModel;
namespace Pager
{
?///
?/// coolPager 的摘要说明。
?///
?public enum SortType
?{
??ASC=0,Desc=1
?};
?public enum IsCount
?{
??noReturnRecordCount=0,returnRecordCount
?};
?[DefaultProperty("copyRight"),
??ToolboxData("<{0}:coolPager runat=server>")]
?public class coolPager : System.Web.UI.WebControls.WebControl,INamingContainer
?{?
??protected int recordCount=0;
??protected Control _controlToPaginate;
??protected PagedDataSource _dataSource;
??[Bindable(true),
???Category("Appearance"),
???DefaultValue("")]
??public string copyRight
??{
???get
???{
????return "版权所有:千山一鸟";
???}
??}
??//连接字符串
??[Description("数据源连接字符串"),DefaultValue("")]
??public string connectionString
??{
???get
???{
????object obj = ViewState["connectionString"];
????return (obj==null)?String.Empty:obj.ToString();
???}
???set
???{
????ViewState["connectionString"]=value;
???}
??}
??//显示分页的控件
??[Description("用于显示分页的控件"),DefaultValue("")]
??public string controlToPaginate
??{
???get
???{
????object obj=ViewState["controlToPaginate"];
????return (obj==null)?String.Empty:obj.ToString();
???}
???set
???{
????ViewState["controlToPaginate"]=value;
???}
??}
??//表名
??[Description("查询表名"),DefaultValue("")]
??public string tableName
??{
???get
???{
????Object obj=ViewState["tableName"];
????return (obj==null)?String.Empty:obj.ToString();
???}
???set
???{
????ViewState["tableName"]=value;
???}
??}
??//排序字段名
??[Description("排序字段"),DefaultValue("")]
??public string fieldName
??{
???get
???{
????Object obj=ViewState["fieldName"];
????return (obj==null)?String.Empty:obj.ToString();
???}
???set
???{
????ViewState["fieldName"]=value;
???}
??}
??//每页显示记录数
??[Description("每页记录数"),DefaultValue("")]
??public int pageSize
??{
???get
???{
????Object obj=ViewState["pageSize"];
????return (obj==null)?15:Convert.ToInt32(obj);
???}
???set
???{
????ViewState["pageSize"]=value;
???}
??}
??//页码
??[Description("当前页码"),DefaultValue("")]
??public int pageIndex
??{
???get
???{
????Object obj=ViewState["pageIndex"];
????return (obj==null)?1:Convert.ToInt32(obj);
???}
???set
???{
????ViewState["pageIndex"]=value;
???}
??}
??//是否返回记录总数
??[Description("是否返回记录总数"),DefaultValue("")]
??public IsCount isCount
??{
???get
???{
????return IsCount.returnRecordCount;
???}
??}
??//排序类型
??[Description("排序类型"),DefaultValue("")]
??public SortType sortType
??{
???get
???{
????Object obj=ViewState["sortType"];
????return (obj==null)?SortType.ASC:(SortType)obj;
???}
???set
???{
????ViewState["sortType"]=value;
???}
??}
??//Where子句
??[Description("where子句,不带where"),DefaultValue("")]
??public string Where
??{
???get
???{
????Object obj=ViewState["Where"];
????return (obj==null)?String.Empty:obj.ToString();
???}
???set
???{
????ViewState["Where"]=value;
???}
??}
??[Descri