PDA

View Full Version : [ASP.NET]Shopping Cart


Cipher
02-12-2005, 02:58 PM
I have two pages contains the products i have and one page for the shopping cart, so i send to this page the product ID in query string, the problem is that i cant collect all ID's of products i choosed, i can only save one ID in this pagem, i tried ArrayList and session but it didnt work, Can You Help Please....... :confused: here's the script it just 4 saving the ID's it's not complete script and i know it's totaly wrong :


<%@ Page Language="VB" Debug="True" %>

<script runat="server">
Sub Page_Load(s as Object, e as EventArgs)
Dim ID as Integer
ID = Request.QueryString("ProductID")
Dim Products as New ArrayList

If Not IsPostBack Then
Session("Products") = Products
End If

Products = Session("Products")
Products.Add(ID)
Session("Products") = Products


Dim i as Integer

For i = 0 to (Products.count - 1)
Response.Write(Products(i) & "<br>")
Next

End Sub
</script>

gwendaal
02-13-2005, 08:27 PM
why don't u use a stringcollection (it will be better a custom collection ....but ...)

Public Caddy as new stringCollection

Session("Caddy") = Caddy

caddy.add(yourID)