<%
gpageSize = 10
pageSize = rs.pageSize
totalPage = rs.PageCount
totalPage = totalRow/gpageSize
pos = inStr(1,totalpage,".")
if pos > 0 then totalpage = int(totalpage)+1
if request("page") <> "" then
gPage = request("page")
pageNo= gPage
else
gPage = 1
end if
gDirect = request("direct")
select Case gDirect
Case "|< หน้าแรก "
pageNo = 1
rs.move pagesize*(pageno - 1)
Case "<< หน้าที่ผ่านมา"
if cInt(gPage) = 1 then
pageNo = 1
else
pageNo = gPage - 1
end if
rs.move pagesize*(pageno - 1)
Case "หน้าถัดไป >>"
if cInt(gPage) = cInt(totalPage) then
pageNo = totalPage
else
if cInt(pageNo) <= cInt(totalPage) then
pageNo = pageNo + 1
else if cInt(pageNo) > cInt(totalPage) then
pageNo = totalPage
else if cInt(pageNo) = cInt(totalPage) then
pageNo = totalPage
end if
end if
end if
end if
rs.move pagesize*(pageno - 1)
Case "หน้าสุดท้าย>|"
pageNo = totalPage
rs.move pagesize*(pageno - 1)
Response.Write="<disabled>"
Case ""
pageNo = 1
rs.move pagesize*(pageno - 1)
End Select
%>