Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Pagination

HI,

Is there anybody wants to help me about asp pagination. i have to display 100 records from the db on the page. How can i limit displaying a records up 10 recordset ever time i select the page number.

need help

Thanks. More power.

Jun

Comments

  • ManningManning Member Posts: 1,621
    : HI,
    :
    : Is there anybody wants to help me about asp pagination. i have to display 100 records from the db on the page. How can i limit displaying a records up 10 recordset ever time i select the page number.


    http://www.4guysfromrolla.com/webtech/121298-1.shtml has some example code.
  • MehanathenMehanathen Member Posts: 13
    If rsCommon.eof Then
    response.write "" &_
    "" &_
    "" &_
    "
    No User(s) Available !
    "
    Else
    if not rsCommon.EOF then
    pageno = cint(Request("nopg"))
    recordcount = rsCommon.RecordCount
    rsCommon.PageSize = 5
    pagecount = rsCommon.PageCount
    if pageno < 1 or pageno = 0 then
    pageno = 1
    elseif pageno > pagecount then
    pageno = pagecount
    end if
    rsCommon.AbsolutePage = pageno
    'response.write rsCommon.PageSize
    end if %>

    <% If not rsCommon.eof Then
    response.write "<tr>"
    response.write "[First] "
    If pageno > 1 Then response.write "[Prev] "
    if Request("nopg")+5 > pagecount then
    counter1 = pagecount - 5
    if counter1<1 then counter1=1
    counter = pagecount
    else
    counter = Request("nopg")+5
    counter1 = Request("nopg")
    end if
    For I = counter1 To counter
    if I = 0 then I=1
    If I = pageno Then
    Response.Write "<span class=bodytxt>"&I&""
    Else
    response.write "&nbsp" & I & ""
    End If
    Next
    If pageno < pagecount Then response.write " [Next]"
    response.write " [Last]"
    response.Write(" Go to Page")
    response.Write(" ")
    response.write " Go"
    response.Write("")
    End IF
    %>
    <%= strMessage %>
    <%
    Inc_value=1+((pageno-1) * 5)
    while not (rsCommon.eof or rsCommon.AbsolutePage <> pageno)
    IF iRecordCount Mod 2 = 0 THEN
    brcolor="#CFEEF9"
    Else
    brcolor="#FFFFFF"
    END IF %> " onMouseOver= "this.bgColor='#c3eaf7';" onMouseOut= "this.bgColor='#FFFFFF';"> <%
    iRecordCount = iRecordCount + 1
    Inc_value=Inc_value+1
    rsCommon.MoveNext
    wend
    rsCommon.close()
    set rsCommon=nothing %>
    S.No
    <% If request("Sortby")="First Name" Then response.Write("←")%>
    First Name

    <% If request("Sortby")="LastName" Then response.Write("←")%>Last Name
    Status User Type
    EMail
    Edit Delete
    <%= Inc_value %>  <%= rsCommon("FirstName") %>  <%= rsCommon("LastName") %>    <% if rsCommon("Status") = "1" then %> image <% else %> image<% end if%>     <%if rsCommon("UserType") = "1" then Response.Write("User") else Response.Write("Support")%>     <%= rsCommon("EMail") %>   " title= "Edit" target="mainbottom"> image ', '<%=rsCommon("FirstName")%>')" title= "Delete"> image
  • MehanathenMehanathen Member Posts: 13
    : If rsCommon.eof Then
    : response.write "" &_
    : "" &_
    : "" &_
    : "
    No User(s) Available !
    "
    : Else
    : if not rsCommon.EOF then
    : pageno = cint(Request("nopg"))
    : recordcount = rsCommon.RecordCount
    : rsCommon.PageSize = 5
    : pagecount = rsCommon.PageCount
    : if pageno < 1 or pageno = 0 then
    : pageno = 1
    : elseif pageno > pagecount then
    : pageno = pagecount
    : end if
    : rsCommon.AbsolutePage = pageno
    : 'response.write rsCommon.PageSize
    : end if %>
    :
    :
    :
    : : <% If not rsCommon.eof Then
    : response.write "<tr>"
    : response.write "[First] "
    : If pageno > 1 Then response.write "[Prev] "
    : if Request("nopg")+5 > pagecount then
    : counter1 = pagecount - 5
    : if counter1<1 then counter1=1
    : counter = pagecount
    : else
    : counter = Request("nopg")+5
    : counter1 = Request("nopg")
    : end if
    : For I = counter1 To counter
    : if I = 0 then I=1
    : If I = pageno Then
    : Response.Write "<span class=bodytxt>"&I&""
    : Else
    : response.write "&nbsp" & I & ""
    : End If
    : Next
    : If pageno < pagecount Then response.write " [Next]"
    : response.write " [Last]"
    : response.Write(" Go to Page")
    : response.Write(" ")
    : response.write " Go"
    : response.Write("")
    : End IF
    : %>
    :
    :
    : : :
    <%= strMessage %>

    :
    :
    : : :
    : : : : : : : : : :
    : : : <%
    : Inc_value=1+((pageno-1) * 5)
    : while not (rsCommon.eof or rsCommon.AbsolutePage <> pageno)
    : IF iRecordCount Mod 2 = 0 THEN
    : brcolor="#CFEEF9"
    : Else
    : brcolor="#FFFFFF"
    : END IF %>
    : " onMouseOver= "this.bgColor='#c3eaf7';" onMouseOut= "this.bgColor='#FFFFFF';">
    : : : : : : :
    : : : <%
    : iRecordCount = iRecordCount + 1
    : Inc_value=Inc_value+1
    : rsCommon.MoveNext
    : wend
    : rsCommon.close()
    : set rsCommon=nothing %>
    :
    : : :
    S.No
    : <% If request("Sortby")="First Name" Then response.Write("←")%>
    : First Name

    : <% If request("Sortby")="LastName" Then response.Write("←")%>Last Name
    StatusUser Type
    : EMail
    EditDelete
    <%= Inc_value %>  <%= rsCommon("FirstName") %> <%= rsCommon("LastName") %>    <% if rsCommon("Status") = "1" then %> image <% else %> image<% end if%>     <%if rsCommon("UserType") = "1" then Response.Write("User") else Response.Write("Support")%>    <%= rsCommon("EMail") %>   " title= "Edit" target="mainbottom"> image ', '<%=rsCommon("FirstName")%>')" title= "Delete"> image
    :
    :

  • eedandsh2eedandsh2 Member Posts: 1
    ur problem is to according the display records :
    why you don't study hard more than you asking people ur quession is bad for me to answer


  • FlakesFlakes Member Posts: 642
    One month from the post ??

    It's funny.
  • ManningManning Member Posts: 1,621
    : One month from the post ??
    :
    : It's funny.

    And it's a reply to the wrong post too. He replied to my reply, instead of to the original question asker.
  • FlakesFlakes Member Posts: 642
    : : One month from the post ??
    : :
    : : It's funny.
    :
    : And it's a reply to the wrong post too. He replied to my reply, instead of to the original question asker.
    :


    Makes it doubly so, doesnt it ? ;-)

    Hey Manning, you ever been here ?

    http://www.programmersheaven.com/c/msgboard/wwwboard.asp?board=455

    Its an off topic place.
Sign In or Register to comment.