日期:2014-05-18  浏览次数:20397 次

菜鸟请教:关于Repeater控件的分页,请指点一下!!!!!
asp.net2.0(c#)   开发webform

Repeater控件的自定义分页的功能已经实现了,不过还有一个问题一直也没有搞定,请看我的问题:

现在我使用DropDownList来显示页码,因为我不知道   1   2   3   4   5……   ,这种分页页码形式是用什么办法实现的??是一个控件??

请指点一下,谢谢!!!

学习,关注…………



------解决方案--------------------
自己生成HTML放进去的
<a href=XX?page=1> 1 </a> ...
------解决方案--------------------
既然你会 DropDown 为什么不会这个?

DropDownList 是将页码添加进其 Items

而 1 2 3 。。。 就是添加创建 HyperLink 或者 直接使用 <a href=... >

假如你用的是 PostBack 方式,那么就应该动态创建 LinkButton 控件
------解决方案--------------------
分好绑上去吧
------解决方案--------------------
分页写在存储过程中。。传入pageIndex和pageSize即可
------解决方案--------------------
再说明一下,分页我已经实现了,只是不知道如何来实现12345……,这种页码的形式(暂时用DropDownList来代替)!!
-------------------------------------
要實現12345……自己要寫code.....
天轟穿有一段視頻(第50,51級)有講到Repeater的分頁...你可以去看看
http://thcjp.cnblogs.com/
------解决方案--------------------

LblCurrentIndex.Text = "当前是第 <font color=#CC0000> " + this.pageIndex + " </font> 页 ";
LblPageCount.Text = "共 <font color=3366FF> " + this.pageCount + " </font> 页, ";
LblRecordCount.Text = " <font color=3366FF> "+this.recordCount + " </font> 条 ";

if (pageCount == 1)
//this.pageLabel.Text = "上一页 / 下一页 ";
{
btnFirst.Text = " <a href= '# ' class=pagesup> 首页 </a> ";
btnPrev.Text = " <a href= '# ' class=pagesup> 上一页 </a> ";
btnNext.Text = " <a href= '# ' class=pagesup> 下一页 </a> ";
btnLast.Text = " <a href= '# ' class=pagesup> 尾页 </a> ";

}
else if (pageIndex <= 1)
{
this.btnFirst.Text = " <a href= '# ' class=pagesup> 首页 </a> ";
btnPrev.Text = " <a href= '# ' class=pagesup> 上一页 </a> ";
btnNext.Text = string.Format( " <a href= 'orderlist.aspx?page={0}&searchstring1={1}&searchstring2={2} ' class=pagesup> 下一页 </a> ", this.pageIndex + 1,this.myDL.SelectedValue,this.DropDownList1.SelectedValue);
btnLast.Text = string.Format( " <a href= 'orderlist.aspx?page={0}&searchstring1={1}&searchstring2={2} ' class=pagesup > 尾页 </a> ", this.pageCount, this.myDL.SelectedValue, this.DropDownList1.SelectedValue);
}

else if (pageIndex > = this.pageCount)
{
this.btnFirst.Text = string.Format( " <a href= 'orderlist.aspx?page={0}&searchstring1={1}&searchstring2={2} ' class=pagesup> 首页 </a> ", '1 ', this.myDL.SelectedValue, this.DropDownList1.SelectedValue);
btnPrev.Text = string.Format( " <a href= 'orderlist.aspx?page={0}&searchstring1={1}&searchstring2={2} ' class=pagesup> 上一页 </a> ", this.pageIndex - 1, this.myDL.SelectedValue, this.DropDownList1.SelectedValue);
btnNext.Text = " <a href= '# ' class=pagesup> 下一页 </a> ";
btnLast.Text = " <a href= '# ' class=pagesup> 尾页 </a> ";