Asp.net中类似于QQ相册中的分页功能怎么实现?
要这样形式的 上一页 1234 下一页,中间的 有多少也是几个数字应该怎么实现?
------解决方案--------------------参见
http://dotnet.aspx.cc/file/Add-Delete-Update-Edit-Data-With-Paging-in-GridView.aspx
------解决方案--------------------aspnetrpager分页控件
------解决方案--------------------Listview+Pager控件
纯JS的话可以JQuery
或者ExtJS
------解决方案--------------------http://www.open-open.com/ajax/Image.htm
------解决方案--------------------在Repeater控件内实现分页功能:
页面中代码
<asp:Repeater ID="RptJobList" runat="server" OnItemDataBound="RptJobList_ItemDataBound">
<FooterTemplate>
<td align = "right" height="30" width = "828" colspan="2" style="font-size:10pt;color:#636363;">
<asp:HyperLink colspan="2" style="font-size:10pt;color:#636363;" ID="hlfir" runat="server" Text="第一页"></asp:HyperLink>
<asp:HyperLink colspan="2" style="font-size:10pt;color:#636363;" ID="hlp" runat="server" Text="上一页"></asp:HyperLink>
<asp:HyperLink colspan="2" style="font-size:10pt;color:#636363;" ID="hln" runat="server" Text="下一页"></asp:HyperLink>
<asp:HyperLink colspan="2" style="font-size:10pt;color:#636363;" ID="hlla" runat="server" Text="最后一页"></asp:HyperLink>
转到第
<asp:DropDownList ID="ddlp" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlp_SelectedIndexChanged" >
</asp:DropDownList>页
</td>
</FooterTemplate>
</asp:Repeater>
.CS代码:
数据绑定函数[自己补充完整即可]
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dt.DefaultView;
pds.AllowPaging = true;//允许分页
pds.PageSize = 20;//单页显示项数
pds.CurrentPageIndex = Convert.ToInt32(Request.QueryString["page"]);
/// <summary>
/// Repeater控件分页 处理
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RptJobList_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Footer)
{
DropDownList ddlp = (DropDownList)e.Item.FindControl("ddlp");
HyperLink lpfirst = (HyperLink)e.Item.FindControl("hlfir");
HyperLink lpprev = (HyperLink)e.Item.FindControl("hlp");
HyperLink lpnext = (HyperLink)e.Item.FindControl("hln");
HyperLink lplast = (HyperLink)e.Item.FindControl("hlla");
PagedDataSource ps = pds();
string a1 = Request.QueryString["page"];
ps.CurrentPageIndex = Convert.ToInt32(a1);
int n = Convert.ToInt32(ps.PageCount);//n为分页数
int i = Convert.ToInt32(ps.CurrentPageIndex);//i为当前页
Label lblpc = (Label)e.Item.FindControl("lblpc");
//if (!IsPostBack)
//{