自己写了个分页,有点问题,请大家看看
static string sql= " ";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
sql = "select [id],[ss],[city],[qy],[pq],[house_name],[address],[hx],[wylx],[jz_area],[jg],[zxcd],[cx],[bs],[cq],[zj],[fk],[fy],[zhuangtai],[kf],[dq],[wt],[ly],[tdjb],[lpwq],[jj],[jd],[jcpt],[bzjc],[cont],[djdate],[gxdate],[ren],[phone],[telphone],[lc],[sumlc],[newold],[wygl],[jt],[pay],[email],[zs],[tuijian],[tuijian1],[niandai],[lc1],[lc2],[gs],[area1],[area2],[dj],[cjr],[lb],[cj],[tel1],[ren1],[pay1],[fx],[fx1],[dian],[salesname],[mjdw],[jgdw],[anjie],[xingzi],[dong],[menpai],[quanshu],[shi],[ting],[wei],[loupan],[jingqudizhi],[ishide] from HouseInfo where [ishide]=1 and [chuqiu]= '1 ' ";
getbind(sql);
}
}
public void getbind(string sql)
{
DataSet ds = new DataSet();
ds = open.getreader(sql);
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView;
int count = ds.Tables[0].Rows.Count;
objPds.AllowPaging = true;
objPds.PageSize = 10;
int CurPage;
if (Request.QueryString[ "Page "] != null)
CurPage = Convert.ToInt32(Request.QueryString[ "Page "]);
else
CurPage = 1;
objPds.CurrentPageIndex = CurPage - 1;
lblCurrentPage.Text =CurPage.ToString();
zongjilu.Text = count.ToString();
int sumye = count / 10 + 1;
sumyema.Text = sumye.ToString();
tiaomeiye.Text = "10 ";
if (!objPds.IsFirstPage)
&