Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Paging with multiple HTML Columns
Message
De
02/02/2004 22:32:40
 
 
À
Tous
Information générale
Forum:
Internet
Catégorie:
Active Server Page
Titre:
Paging with multiple HTML Columns
Divers
Thread ID:
00873251
Message ID:
00873251
Vues:
44
Hello All,

I am doing my head in with a bit of code for Paging my database records.

The thing is for every two records that come from the database I want them display like:
'So basicly for the first record it adds:
	<tr>
		<td>Record 1</td>
' And Then The Second Record it adds
		<td>Record 2</td>
	</tr>
So with the end result like:
<table>
	<tr>
		<td>Test 1</td> ' Record One
		<td>Test 2</td> ' Record Two
	</tr>
	<tr>
		<td>Test 3</td> ' Record Three
		<td>Test 4</td> ' Record Four
	</tr>
	<tr>
		<td>Test 5</td> ' Record Five
		<td>Test 6</td> ' Record Six
	</tr>
</table>

' And so On.
Here is what I have done and I would really appreciate it if some could offer some advice or a fix for this situation.
Dim OffSet, PerPage, Cols, ItmCnt, StrBgColour
PerPage = "6"
Cols = 2
StrBgColour = True

If Request("OffSet") = "" Then
	OffSet = 1
Else
	OffSet = CInt(Request.QueryString("OffSet"))
End If
SQL = "SELECT * FROM Cart ORDER BY ItemTitle Asc;"
objRS.Open SQL, objConn, adopenkeyset, adlockoptimistic

If objRS.EOF Then

Else
	objRS.Move OffSet - 1
	Response.Write("<table width=""100%"" border=""0"" cellspacing=""0"" cellpadding=""4"">")
	For row = OffSet To OffSet + (PerPage - 1)
		If StrBgColour = True Then
			StrColour = "#F1F1F1"
		Else
			StrColour = "#FFFFE0"
		End If
		If objRS.EOF Then Exit For
		Response.Write("<tr>")
		ItmCnt = 0
		Do Until ItmCnt = Cols
Response.Write("<td align=""center"" valign=""top"">" & Trim(objRS("ItemTitle")) & "</td>")
				
			objRS.MoveNext
			ItmCnt = ItmCnt + 1
			row = row + 1
		Loop
		Response.Write("</tr>")
		If StrBgColour = True Then
			StrBgColour = False
		Else
			StrBgColour = True
		End If
	Next
	Response.Write("</table>")

	Response.Write("<br>")

	If OffSet = 1 Then
		Response.Write("<<PREVIOUS | ")
	Else
		Response.Write("<a href=""?OffSet=" & OffSet - PerPage & """ class=""OFFSET""><<PREVIOUS</a> | ")
	End If

	For n = 1 To objRS.RecordCount step PerPage
		If n <> 1 Then Response.Write(" | ")
		If n = OffSet Then
			Response.Write("<b style=""color: #336699;"">")
		Else
			Response.Write("<a href=""?OffSet=" & n & """ class=""OFFSET"">")
		End If
		Response.Write("" & n & " to ") 
		If n + PerPage <= objRS.RecordCount Then
			Response.Write n + (PerPage) - 1
		Else
			Response.Write objRS.RecordCount
		End If
		If n = OffSet Then
			Response.Write("</b>")
		Else
			Response.Write("</a>")
		End If
	Next
	If OffSet + PerPage <= objRS.RecordCount Then
		Response.Write(" | <a href=""?OffSet=" & OffSet + PerPage & """ class=""OFFSET"">NEXT>></a>")
	Else
		Response.Write(" | NEXT>>")
	End If
End If
Sorry for post so much code but if Any body has any ideas I would appreciate the input.

Kind Regards,
Tarran Walker
tarran.walker@reliez.com.au
Répondre
Fil
Voir

Click here to load this message in the networking platform