.net 分页 要求效果是 上一页1 2 3 4 5 6 下一页

来源:百度知道 编辑:UC知道 时间:2024/06/20 14:47:55
最好是手写
我用的是 DataList 或者是table 所以要自己写个分页

DataList是不具备自动分页的功能的......

DataList与DataGrid都是很好用的控件,但是非常遗憾的是DataList不具有象DataGrid那样的自动分页功能,即:他不具备PageSize这样的属性来控制分页,而DataGrid却不具备DataList的RepeatDirection和 RepeatColumns属性。本人根据DataGrid的分页思想自己写了个DataList的分页程序,如有什么不足的地方欢迎指正.

a.aspx页:

<TABLE cellSpacing=0 cellPadding=0 width=784 height="120" align=center border=0>
<tr>
<td align=center>
<asp:datalist id="MyDataGrid" RepeatDirection=Horizontal RepeatColumns=5 showfooter=true borderwidth=0 runat=server>
<HeaderTemplate>
<table width=784 cellpadding=0 cellspacing=0 border=0 >
<tr>
</HeaderTemplate>
<ItemTemplate>
<td align=center>
<table width="100%" height="120">
<tr