private void NewBin()
{
try
{
string strNode = Request.QueryString["Node"].ToString();
Sql sql = new Sql();
PagedDataSource pds = new PagedDataSource();
string strWhere = null;
strWhere = "j_Article_partentID=" + strNode;
DataTable dt = sql.SelectArticle(strWhere).Tables[0];//查询节点下的所有内容列表
this.sumList.Text = dt.Rows.Count.ToString();
if (dt.Rows.Count > 0)
{
int pageindex = 0;
int pages = 0;
int nowpage = 0;
pds.DataSource = dt.DefaultView;
pds.AllowPaging = true;
pds.PageSize = 10;//每页显示数
this.sumList.Text = "共 " + dt.Rows.Count.ToString() + " 条信息";//总共多少条信息
if (Request.QueryString["pageid"] != null && Convert.ToInt32(Request.QueryString["pageid"]) > 0 && Convert.ToInt32(Request.QueryString["pageid"]) <= pds.PageCount)
{
pageindex = Convert.ToInt32(Request.QueryString["pageid"]);
}
else if (Convert.ToInt32(Request.QueryString["pageid"]) > pds.PageCount)
{
pageindex = pds.PageCount;
}
else
{
pageindex = 1;
}
pds.CurrentPageIndex = pageindex - 1;
if (!pds.IsFirstPage)
{
pre.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=" + Convert.ToInt32(pageindex - 1);
next.CssClass = "disposepage";
pre.CssClass = "onpage";
}
if (!pds.IsLastPage)
{
next.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=" + Convert.ToInt32(pageindex + 1) ;
pre.CssClass = "disposepage";
next.CssClass = "onpage";
}
if (!pds.IsFirstPage)
{
first.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=1";
}
if (!pds.IsLastPage)
{
last.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=" + Convert.ToInt32(pds.PageCount);
}
nowpage = pds.CurrentPageIndex + 1;
pages = pds.PageCount;
lblPage.Text = "页次:" + nowpage + "/" + pages + " 页";
sumpage.Text = pds.PageSize.ToString();
for (int i = 1; i <= pages; i++)
{
this.txtPage.Items.Add(i.ToString());
}
this.new_con.DataSource = pds;
this.new_con.DataBind();
}
}
catch (Exception ex)
{
//this.sumList.Text = "共 0 条信息";//总共多少条信息
//sumpage.Text = "10";
throw new Exception(ex.Message);
}
}
{
try
{
string strNode = Request.QueryString["Node"].ToString();
Sql sql = new Sql();
PagedDataSource pds = new PagedDataSource();
string strWhere = null;
strWhere = "j_Article_partentID=" + strNode;
DataTable dt = sql.SelectArticle(strWhere).Tables[0];//查询节点下的所有内容列表
this.sumList.Text = dt.Rows.Count.ToString();
if (dt.Rows.Count > 0)
{
int pageindex = 0;
int pages = 0;
int nowpage = 0;
pds.DataSource = dt.DefaultView;
pds.AllowPaging = true;
pds.PageSize = 10;//每页显示数
this.sumList.Text = "共 " + dt.Rows.Count.ToString() + " 条信息";//总共多少条信息
if (Request.QueryString["pageid"] != null && Convert.ToInt32(Request.QueryString["pageid"]) > 0 && Convert.ToInt32(Request.QueryString["pageid"]) <= pds.PageCount)
{
pageindex = Convert.ToInt32(Request.QueryString["pageid"]);
}
else if (Convert.ToInt32(Request.QueryString["pageid"]) > pds.PageCount)
{
pageindex = pds.PageCount;
}
else
{
pageindex = 1;
}
pds.CurrentPageIndex = pageindex - 1;
if (!pds.IsFirstPage)
{
pre.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=" + Convert.ToInt32(pageindex - 1);
next.CssClass = "disposepage";
pre.CssClass = "onpage";
}
if (!pds.IsLastPage)
{
next.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=" + Convert.ToInt32(pageindex + 1) ;
pre.CssClass = "disposepage";
next.CssClass = "onpage";
}
if (!pds.IsFirstPage)
{
first.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=1";
}
if (!pds.IsLastPage)
{
last.NavigateUrl = Request.CurrentExecutionFilePath + "?Node=" + strNode.ToString() + "&pageid=" + Convert.ToInt32(pds.PageCount);
}
nowpage = pds.CurrentPageIndex + 1;
pages = pds.PageCount;
lblPage.Text = "页次:" + nowpage + "/" + pages + " 页";
sumpage.Text = pds.PageSize.ToString();
for (int i = 1; i <= pages; i++)
{
this.txtPage.Items.Add(i.ToString());
}
this.new_con.DataSource = pds;
this.new_con.DataBind();
}
}
catch (Exception ex)
{
//this.sumList.Text = "共 0 条信息";//总共多少条信息
//sumpage.Text = "10";
throw new Exception(ex.Message);
}
}