ASP PageMinder
Demo 1 - Column sorting & page navigation
<%
' declare the variables used on this page
Dim pm
' create an instance of the PageMinder object
Set pm = Server.CreateObject ("ASPaxis.PageMinder")
pm.SetPageRows = 15 ' set a default number of rows to display per page
pm.SetConnection = CONN_SQLSERVER ' db connection string and SQL command
pm.SetSource = "SELECT Region, WineName, Vintage, CostPerBottle, ImagePath FROM WineList"
Function ShowCurrency (field)
If IsNumeric(field) Then ShowCurrency = FormatCurrency (field, 2, -2, -2, -2)
End Function
%>
...HTML...
<table id="winedata" summary="Winelist data">
<% If pm.InitRS Then %>
<tr>
<td colspan="4">
<span class="pagebar"><%= pm.CreatePageBar_All %></span>
<span class="records">Wines <%= pm.CurrentPageFirstItem %> to
<%= pm.CurrentPageLastItem %> of <%= pm.RecordsetTotalItems %></span>
</td>
</tr>
<tr>
<th><%= pm.CreateHeading ("Region", "Region") %></th>
<th><%= pm.CreateHeading ("WineName", "Name") %></th>
<th><%= pm.CreateHeading ("Vintage", "Vintage") %></th>
<th><%= pm.CreateHeading ("CostPerBottle", "Price") %></th>
</tr>
<% Do %>
<tr>
<td class="col1"><%= pm.GetItem ("Region") %></td>
<td class="col2"><%= pm.GetItem ("WineName") %></td>
<td class="col3"><%= pm.GetItem ("Vintage") %></td>
<td class="col4"><%= ShowCurrency (pm.GetItem ("CostPerBottle")) %></td>
</tr>
<%
pm.MoveNextItem
Loop Until pm.CurrentPageRowEnd
%>
<tr>
<td colspan="4">
<div class="border">
<span class="pagebar"><%= pm.CreatePageBar_All %></span>
<span class="records">Wines <%= pm.CurrentPageFirstItem %> to
<%= pm.CurrentPageLastItem %> of <%= pm.RecordsetTotalItems %></span>
</div>
</td>
</tr>
<%
Set pm = Nothing
End If
%>
</table>
...HTML...