public void dListBind()
{
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["conn"]);
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter("select * from Content", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
PagedDataSource objPds = new PagedDataSource();
objPds.DataSource = ds.Tables[0].DefaultView;
objPds.AllowPaging = true;
objPds.PageSize = 2;
int CurPage;
if (Request.QueryString["Page"] != null)
CurPage = Convert.ToInt32(Request.QueryString["Page"]);
else
CurPage = 1;
objPds.CurrentPageIndex = CurPage - 1;
lblCurrentPage.Text = "当前页:" + CurPage.ToString();
if (!objPds.IsFirstPage)
lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
if (!objPds.IsLastPage)
lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
DataList1.DataSource = objPds;
DataList1.DataBind();
}