我现在在做电子商务网站,用ASP.net做,怎么用Repeater控件进行分页?
解决方案 »
- Response.ContentType = "application/vnd.ms-excel"; 导出EXCEL时的文件大小限制问题
- SQL语句 nvarchar型的日期的大小比较
- dropdownlist添加自定义属性来替代selectedIndexChanged事件出问题
- 哪位大哥给说明一下WebHtmlEditor_1_6_2006_0219_Release怎么引用啊?
- 怎样在aspx文件中引用外部的文件
- 如何去掉回车符和空格符?
- 请教关于代码后置的问题
- 有没有可以灵活切换页面CSS风格的例子?
- 请问如何把一个颜色字符串(如“#F3F4F7”)转换为System.Drawing.Color对象
- 请问哪里有大量的asp.net web控件库?国外的和国内的都可以。
- GridView问题
- 关于数据访问层打开关闭数据库的疑惑
Dim myStr As String
Dim TotalPage As Integer
Dim i As Integer
Dim Tmp As String
If myTotalRecord = 0 Then Exit Function
If myTotalRecord Mod myPageSize > 0 Then
TotalPage = Fix(myTotalRecord / myPageSize) + 1
Else
TotalPage = myTotalRecord / myPageSize
End If
myStr += "共 " & myTotalRecord & " 条记录 每页 " & myPageSize & " 条记录 当前 " & myPageNums & "/" & TotalPage & " 页 "
If Not myPageNums = 1 Then
myStr += "[<a href=" & myPageUrl & "?Page=1" & Other & ">第一页</a>][<a href=" & myPageUrl & "?Page=" & Convert.ToString(myPageNums - 1) & Other & ">上一页</a>]"
End If
If Not myPageNums = TotalPage Then
myStr += "[<a href=" & myPageUrl & "?Page=" & Convert.ToString(myPageNums + 1) & Other & ">下一页</a>][<a href=" & myPageUrl & "?Page=" & TotalPage & Other & ">最后页</a>]"
End If
myStr += " <select name=Page onchange=window.location='" & myPageUrl & "?Page='+this.value+'" & Other & "'>"
For i = 1 To TotalPage
Tmp += "<option value=" & i & ""
If i = myPageNums Then Tmp += " selected"
Tmp += ">" & i & "</option>"
Next
myStr += Tmp & "</select>"
Return myStr
End Function
objpage.DataSource=ds.Tables["PU_friend"].DefaultView;
objpage.AllowPaging=true;
objpage.PageSize=12;
int curpage;
if(Request.QueryString["Page"]!=null)
curpage=Convert.ToInt32(Request.QueryString["Page"]);
else
curpage=1;
objpage.CurrentPageIndex=curpage-1;
if(objpage.IsFirstPage&&!objpage.IsLastPage)
{
this.hlProv.Enabled=false;
this.hlNext.NavigateUrl="Qw_morephotos.aspx?page="+Convert.ToInt32(curpage+1);
this.hlFirst.Enabled=false;
this.hlLast.NavigateUrl="Qw_morephotos.aspx?page="+Convert.ToInt32(objpage.PageCount);
}
else
{
if(objpage.IsLastPage&&!objpage.IsFirstPage)
{
this.hlFirst.NavigateUrl="Qw_morephotos.aspx?page="+1;
this.hlLast.Enabled=false;
this.hlNext.Enabled=false;
this.hlProv.NavigateUrl="Qw_morephotos.aspx?page="+Convert.ToInt32(curpage-1);
}
else
{
if(objpage.IsFirstPage&&objpage.IsLastPage)
{
this.hlLast.Enabled=false;
this.hlNext.Enabled=false;
this.hlProv.Enabled=false;
this.hlFirst.Enabled=false;
}
else
{
this.hlFirst.NavigateUrl="Qw_morephotos.aspx?page="+1;
this.hlLast.NavigateUrl="Qw_morephotos.aspx?page="+Convert.ToInt32(objpage.PageCount);
this.hlNext.NavigateUrl="Qw_morephotos.aspx?page="+Convert.ToInt32(curpage+1);
this.hlProv.NavigateUrl="Qw_morephotos.aspx?page="+Convert.ToInt32(curpage-1);
}
}
}
this.dlHot.DataSource=objpage;
this.dlHot.DataBind();